BeezUP_Module_feed_and_tracker - Version 4.0.0

Version Notes

New features :
> Export Orders from Marketplaces
> Fixed bug in category management

Download this release

Release Info

Developer BeezUP
Extension BeezUP_Module_feed_and_tracker
Version 4.0.0
Comparing to
See all releases


Code changes from version 3.2.0 to 4.0.0

Files changed (114) hide show
  1. app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php +51 -0
  2. app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Grid.php +235 -0
  3. app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Invoice/Totals.php +57 -0
  4. app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Totals.php +55 -0
  5. app/code/community/BeezUp/Block/Adminhtml/Sales/Order/View/Tab/Custom.php +36 -0
  6. app/code/community/BeezUp/Block/Adminhtml/System/Config/Attributes.php +166 -0
  7. app/code/community/BeezUp/Block/Adminhtml/System/Config/Button.php +56 -0
  8. app/code/community/BeezUp/Block/Adminhtml/System/Config/Childgroup.php +33 -0
  9. app/code/community/BeezUp/Block/Adminhtml/System/Config/Credentials.php +48 -0
  10. app/code/community/BeezUp/Block/Adminhtml/System/Config/Cron.php +16 -0
  11. app/code/community/BeezUp/Block/Adminhtml/System/Config/Filter.php +163 -0
  12. app/code/community/BeezUp/Block/Adminhtml/System/Config/Log.php +65 -0
  13. app/code/community/BeezUp/Block/Adminhtml/System/Config/Manualcron.php +14 -0
  14. app/code/community/BeezUp/Block/Adminhtml/System/Config/Stores.php +69 -0
  15. app/code/community/BeezUp/Block/Adminhtml/System/Config/Syncstatus.php +26 -0
  16. app/code/community/BeezUp/Block/Adminhtml/System/Config/Time.php +24 -0
  17. app/code/community/BeezUp/Block/Order.php +1143 -0
  18. app/code/community/BeezUp/Block/Tracking.php +96 -96
  19. app/code/community/BeezUp/Block/Xml.php +745 -727
  20. app/code/community/BeezUp/Helper/Data.php +67 -67
  21. app/code/community/BeezUp/Model/Flatrate.php +91 -0
  22. app/code/community/BeezUp/Model/Observer.php +31 -31
  23. app/code/community/BeezUp/Model/Products.php +320 -291
  24. app/code/community/BeezUp/Model/Quote/Item.php +115 -0
  25. app/code/community/BeezUp/Model/Sales/Order/Pdf/Invoice.php +87 -0
  26. app/code/community/BeezUp/Model/System/Config/Backend/Attributes.php +26 -0
  27. app/code/community/BeezUp/Model/System/Config/Backend/Credentials.php +32 -0
  28. app/code/community/BeezUp/Model/System/Config/Backend/Time.php +23 -0
  29. app/code/community/BeezUp/Model/System/Config/Backend/Token.php +28 -0
  30. app/code/community/BeezUp/Model/System/Config/Source/Attributes.php +20 -20
  31. app/code/community/BeezUp/Model/System/Config/Source/Availableproducts.php +14 -0
  32. app/code/community/BeezUp/Model/System/Config/Source/Cache.php +19 -19
  33. app/code/community/BeezUp/Model/System/Config/Source/Debug.php +13 -0
  34. app/code/community/BeezUp/Model/System/Config/Source/Description.php +14 -14
  35. app/code/community/BeezUp/Model/System/Config/Source/Images.php +13 -13
  36. app/code/community/BeezUp/Model/System/Config/Source/Montant.php +15 -15
  37. app/code/community/BeezUp/Model/System/Config/Source/Payment.php +22 -0
  38. app/code/community/BeezUp/Model/System/Config/Source/Position.php +13 -13
  39. app/code/community/BeezUp/Model/System/Config/Source/Price.php +13 -13
  40. app/code/community/BeezUp/Model/System/Config/Source/Shipping.php +39 -0
  41. app/code/community/BeezUp/Model/System/Config/Source/Status.php +23 -0
  42. app/code/community/BeezUp/Model/System/Config/Source/Userid.php +10 -0
  43. app/code/community/BeezUp/controllers/CacheController.php +21 -0
  44. app/code/community/BeezUp/controllers/CatalogController.php +35 -35
  45. app/code/community/BeezUp/controllers/CronController.php +23 -0
  46. app/code/community/BeezUp/controllers/LogController.php +19 -0
  47. app/code/community/BeezUp/controllers/Sales/OrderController.php +68 -0
  48. app/code/community/BeezUp/etc/adminhtml.xml +60 -0
  49. app/code/community/BeezUp/etc/config.xml +198 -123
  50. app/code/community/BeezUp/etc/system.xml +573 -244
  51. app/code/community/BeezUp/lib/BeezupMageOrders.php +301 -0
  52. app/code/community/BeezUp/lib/BeezupOMDataHandler.php +68 -0
  53. app/code/community/BeezUp/lib/BeezupOMOrderService.php +613 -0
  54. app/code/community/BeezUp/lib/BeezupOMOrderServiceInterface.php +10 -0
  55. app/code/community/BeezUp/lib/BeezupOMRepositoryInterface.php +103 -0
  56. app/code/community/BeezUp/lib/BeezupOMRequestData.php +112 -0
  57. app/code/community/BeezUp/lib/BeezupOMResponseData.php +88 -0
  58. app/code/community/BeezUp/lib/BeezupOMServiceClientProxy.php +671 -0
  59. app/code/community/BeezUp/lib/BeezupRepository.php +317 -0
  60. app/code/community/BeezUp/lib/Common/BeezupOMCredential.php +62 -0
  61. app/code/community/BeezUp/lib/Common/BeezupOMErrorSummary.php +3 -0
  62. app/code/community/BeezUp/lib/Common/BeezupOMExpectedOrderChangeMetaInfo.php +133 -0
  63. app/code/community/BeezUp/lib/Common/BeezupOMInfoSummaries.php +111 -0
  64. app/code/community/BeezUp/lib/Common/BeezupOMInfoSummary.php +3 -0
  65. app/code/community/BeezUp/lib/Common/BeezupOMLink.php +183 -0
  66. app/code/community/BeezUp/lib/Common/BeezupOMOrderIdentifier.php +159 -0
  67. app/code/community/BeezUp/lib/Common/BeezupOMProcessingStatus.php +10 -0
  68. app/code/community/BeezUp/lib/Common/BeezupOMRequest.php +33 -0
  69. app/code/community/BeezUp/lib/Common/BeezupOMResponse.php +105 -0
  70. app/code/community/BeezUp/lib/Common/BeezupOMResult.php +7 -0
  71. app/code/community/BeezUp/lib/Common/BeezupOMSuccessSummary.php +3 -0
  72. app/code/community/BeezUp/lib/Common/BeezupOMSummary.php +41 -0
  73. app/code/community/BeezUp/lib/Common/BeezupOMWarningSummary.php +3 -0
  74. app/code/community/BeezUp/lib/Harvest/BeezupOMHarvestAbstractReporting.php +3 -0
  75. app/code/community/BeezUp/lib/Harvest/BeezupOMHarvestClientReporting.php +239 -0
  76. app/code/community/BeezUp/lib/Harvest/BeezupOMHarvestOrderReporting.php +291 -0
  77. app/code/community/BeezUp/lib/KLogger.php +148 -0
  78. app/code/community/BeezUp/lib/LOV/BeezupOMLOVRequest.php +43 -0
  79. app/code/community/BeezUp/lib/LOV/BeezupOMLOVResponse.php +14 -0
  80. app/code/community/BeezUp/lib/LOV/BeezupOMLOVResult.php +61 -0
  81. app/code/community/BeezUp/lib/LOV/BeezupOMLOVValue.php +104 -0
  82. app/code/community/BeezUp/lib/Order/BeezupOMOrderItem.php +332 -0
  83. app/code/community/BeezUp/lib/Order/BeezupOMOrderRequest.php +132 -0
  84. app/code/community/BeezUp/lib/Order/BeezupOMOrderResponse.php +78 -0
  85. app/code/community/BeezUp/lib/Order/BeezupOMOrderResult.php +1176 -0
  86. app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeMetaInfo.php +86 -0
  87. app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeRequest.php +117 -0
  88. app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeResponse.php +88 -0
  89. app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeResult.php +75 -0
  90. app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderChangeReporting.php +231 -0
  91. app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHarvestReporting.php +172 -0
  92. app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHistoryRequest.php +69 -0
  93. app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHistoryResponse.php +49 -0
  94. app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHistoryResult.php +103 -0
  95. app/code/community/BeezUp/lib/OrderList/BeezupOMOrderHeader.php +351 -0
  96. app/code/community/BeezUp/lib/OrderList/BeezupOMOrderListRequest.php +140 -0
  97. app/code/community/BeezUp/lib/OrderList/BeezupOMOrderListResponse.php +23 -0
  98. app/code/community/BeezUp/lib/OrderList/BeezupOMOrderListResult.php +63 -0
  99. app/code/community/BeezUp/lib/OrderList/BeezupOMPaginationResult.php +91 -0
  100. app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdRequest.php +54 -0
  101. app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdResponse.php +11 -0
  102. app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdResult.php +3 -0
  103. app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdValues.php +81 -0
  104. app/code/community/BeezUp/lib/Stores/BeezupOMStore.php +57 -0
  105. app/code/community/BeezUp/lib/Stores/BeezupOMStoresRequest.php +3 -0
  106. app/code/community/BeezUp/lib/Stores/BeezupOMStoresResponse.php +12 -0
  107. app/code/community/BeezUp/lib/Stores/BeezupOMStoresResult.php +43 -0
  108. app/code/community/BeezUp/lib/bootstrap.php +72 -0
  109. app/code/community/BeezUp/sql/beezup_setup/mysql4-install-4.0.0.php +125 -0
  110. app/design/adminhtml/default/default/layout/beezup_salestab.xml +8 -0
  111. app/design/adminhtml/default/default/template/beezup/custom.phtml +50 -0
  112. app/locale/en_US/BeezUp.csv +109 -70
  113. app/locale/fr_FR/BeezUp.csv +122 -60
  114. package.xml +10 -7
app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Block_Adminhtml_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals
4
+ {
5
+ /**
6
+ * Initialize order totals array
7
+ *
8
+ * @return Mage_Sales_Block_Order_Totals
9
+ */
10
+ protected function _initTotals()
11
+ {
12
+
13
+ $id =$this->getSource()->getQuoteId();
14
+ $resource = Mage::getSingleton('core/resource');
15
+ $readConnection = $resource->getConnection('core_read');
16
+ $table = $resource->getTableName('sales/quote_address');
17
+ $query = 'SELECT beezup_fee FROM ' . $table . ' WHERE quote_id = '.$id.' and address_type = \'shipping\' LIMIT 1';
18
+ $fee = $readConnection->fetchOne($query);
19
+ parent::_initTotals();
20
+ $amount = 20;
21
+
22
+ if ($fee>0) {
23
+ $this->addTotalBefore(new Varien_Object(array(
24
+ 'code' => 'turnkeye_insurance',
25
+ 'value' => $fee,
26
+ 'base_value'=> $fee,
27
+ 'label' => $this->helper('beezup')->__('Special Fee'),
28
+ ), array('shipping', 'tax')));
29
+ }
30
+ $this->_totals['paid'] = new Varien_Object(array(
31
+ 'code' => 'paid',
32
+ 'strong' => true,
33
+ 'value' => $this->getSource()->getTotalPaid() +$fee,
34
+ 'base_value'=> $this->getSource()->getBaseTotalPaid() + $fee,
35
+ 'label' => $this->helper('sales')->__('Total Paid'),
36
+ 'area' => 'footer'
37
+ ));
38
+
39
+ $this->_totals['grand_total'] = new Varien_Object(array(
40
+ 'code' => 'grand_total',
41
+ 'strong' => true,
42
+ 'value' => $this->getSource()->getGrandTotal() +$fee,
43
+ 'base_value'=> $this->getSource()->getBaseGrandTotal() +$fee,
44
+ 'label' => $this->helper('sales')->__('Grand Total'),
45
+ 'area' => 'footer'
46
+ ));
47
+
48
+ // $this->setGrandTotal($this->getGrandTotal() + 20);
49
+ return $this;
50
+ }
51
+ }
app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Grid.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml sales orders grid
5
+ *
6
+ * @author Inchoo <ivan.galambos@inchoo.net>
7
+ */
8
+ class BeezUp_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+
11
+ public function __construct()
12
+ {
13
+
14
+ parent::__construct();
15
+
16
+ $this->setId('sales_order_grid');
17
+ $this->setUseAjax(true);
18
+ $this->setDefaultSort('created_at');
19
+ $this->setDefaultSort('entity_id');
20
+ $this->setDefaultDir('DESC');
21
+ $this->setSaveParametersInSession(true);
22
+
23
+ if ($this->getRequest()->getParam('prepared') === 'beezup') {
24
+ $this->setDefaultFilter( array(
25
+ 'beezup_order' => '1'
26
+ ) );
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Modify column filter if needed by custom implementation of IN() and NOT IN() MySQL statement + prepared filter functionality
32
+ *
33
+ */
34
+ protected function _addColumnFilterToCollection($column)
35
+ {
36
+ $filterArr = Mage::registry('preparedFilter');
37
+
38
+ if (($column->getId() === 'store_id' || $column->getId() === 'status') && $column->getFilter()->getValue() && strpos($column->getFilter()->getValue(), ',')) {
39
+
40
+ $_inNin = explode(',', $column->getFilter()->getValue());
41
+ $inNin = array();
42
+
43
+ foreach ($_inNin as $k => $v) {
44
+ if (is_string($v) && strlen(trim($v))) {
45
+ $inNin[] = trim($v);
46
+ }
47
+ }
48
+
49
+ if (count($inNin)>1 && in_array($inNin[0], array('in', 'nin'))) {
50
+ $in = $inNin[0];
51
+ $values = array_slice($inNin, 1);
52
+ $this->getCollection()->addFieldToFilter($column->getId(), array($in => $values));
53
+ } else {
54
+ parent::_addColumnFilterToCollection($column);
55
+
56
+ }
57
+ } elseif (is_array($filterArr) && array_key_exists($column->getId(), $filterArr) && isset($filterArr[$column->getId()])) {
58
+ $this->getCollection()->addFieldToFilter($column->getId(), $filterArr[$column->getId()]);
59
+
60
+ } else {
61
+ parent::_addColumnFilterToCollection($column);
62
+
63
+ }
64
+ // Zend_Debug::dump((string)$this->getCollection()->getSelect(), 'Prepared filter:');
65
+ return $this;
66
+ }
67
+ /**
68
+ * Retrieve collection class
69
+ *
70
+ * @return string
71
+ */
72
+ protected function _getCollectionClass()
73
+ {
74
+ return 'sales/order_grid_collection';
75
+ }
76
+
77
+ protected function _prepareCollection()
78
+ {
79
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
80
+ $this->setCollection($collection);
81
+ return parent::_prepareCollection();
82
+ }
83
+
84
+ protected function _prepareColumns()
85
+ {
86
+ $this->addColumn('real_order_id', array(
87
+ 'header'=> Mage::helper('sales')->__('Order #'),
88
+ 'width' => '80px',
89
+ 'type' => 'text',
90
+ 'index' => 'increment_id',
91
+ ));
92
+ if (!Mage::app()->isSingleStoreMode()) {
93
+ $this->addColumn('store_id', array(
94
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
95
+ 'index' => 'store_id',
96
+ // 'type' => 'store',
97
+ // 'store_view'=> true,
98
+ // 'display_deleted' => true,
99
+ ));
100
+ }
101
+ $this->addColumn('created_at', array(
102
+ 'header' => Mage::helper('sales')->__('Purchased On'),
103
+ 'index' => 'created_at',
104
+ 'type' => 'datetime',
105
+ 'width' => '100px',
106
+ ));
107
+ $this->addColumn('billing_name', array(
108
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
109
+ 'index' => 'billing_name',
110
+ ));
111
+ $this->addColumn('shipping_name', array(
112
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
113
+ 'index' => 'shipping_name',
114
+ ));
115
+
116
+ if ($this->getRequest()->getParam('prepared') === 'beezup') {
117
+ $this->addColumn('beezup_marketplace', array(
118
+ 'header' =>Mage::helper('beezup')->__('Marketplace'),
119
+ 'index' => 'beezup_marketplace',
120
+ ));
121
+
122
+
123
+ $this->addColumn('beezup_order', array(
124
+ 'header' => Mage::helper('beezup')->__('Beezup Order'),
125
+ 'index' => 'beezup_order',
126
+ 'column_css_class'=>'no-display',//this sets a css class to the column row item
127
+ 'header_css_class'=>'no-display',//this sets a css class to the column header
128
+ ));
129
+
130
+ $this->addColumn('beezup_market_order_id', array(
131
+ 'header' => Mage::helper('beezup')->__('Marketplace Order Id'),
132
+ 'index' => 'beezup_market_order_id',
133
+ ));
134
+
135
+ }
136
+ $this->addColumn('base_grand_total', array(
137
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
138
+ 'index' => 'base_grand_total',
139
+ 'type' => 'currency',
140
+ 'currency' => 'base_currency_code',
141
+ ));
142
+ $this->addColumn('grand_total', array(
143
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
144
+ 'index' => 'grand_total',
145
+ 'type' => 'currency',
146
+ 'currency' => 'order_currency_code',
147
+ ));
148
+ $this->addColumn('status', array(
149
+ 'header' => Mage::helper('sales')->__('Status'),
150
+ 'index' => 'status',
151
+ 'type' => 'options',
152
+ 'width' => '100px',
153
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
154
+ ));
155
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
156
+ $this->addColumn('action',
157
+ array(
158
+ 'header' => Mage::helper('sales')->__('Action'),
159
+ 'width' => '50px',
160
+ 'type' => 'action',
161
+ 'getter' => 'getId',
162
+ 'actions' => array(
163
+ array(
164
+ 'caption' => Mage::helper('sales')->__('View'),
165
+ 'url' => array('base'=>'*/sales_order/view'),
166
+ 'field' => 'order_id'
167
+ )
168
+ ),
169
+ 'filter' => false,
170
+ 'sortable' => false,
171
+ 'index' => 'stores',
172
+ 'is_system' => true,
173
+ ));
174
+ }
175
+ $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
176
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
177
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
178
+ return parent::_prepareColumns();
179
+ }
180
+
181
+ protected function _prepareMassaction()
182
+ {
183
+ $this->setMassactionIdField('entity_id');
184
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
185
+ $this->getMassactionBlock()->setUseSelectAll(false);
186
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
187
+ $this->getMassactionBlock()->addItem('cancel_order', array(
188
+ 'label'=> Mage::helper('sales')->__('Cancel'),
189
+ 'url' => $this->getUrl('*/sales_order/massCancel'),
190
+ ));
191
+ }
192
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
193
+ $this->getMassactionBlock()->addItem('hold_order', array(
194
+ 'label'=> Mage::helper('sales')->__('Hold'),
195
+ 'url' => $this->getUrl('*/sales_order/massHold'),
196
+ ));
197
+ }
198
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
199
+ $this->getMassactionBlock()->addItem('unhold_order', array(
200
+ 'label'=> Mage::helper('sales')->__('Unhold'),
201
+ 'url' => $this->getUrl('*/sales_order/massUnhold'),
202
+ ));
203
+ }
204
+ $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
205
+ 'label'=> Mage::helper('sales')->__('Print Invoices'),
206
+ 'url' => $this->getUrl('*/sales_order/pdfinvoices'),
207
+ ));
208
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
209
+ 'label'=> Mage::helper('sales')->__('Print Packingslips'),
210
+ 'url' => $this->getUrl('*/sales_order/pdfshipments'),
211
+ ));
212
+ $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
213
+ 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
214
+ 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
215
+ ));
216
+ $this->getMassactionBlock()->addItem('pdfdocs_order', array(
217
+ 'label'=> Mage::helper('sales')->__('Print All'),
218
+ 'url' => $this->getUrl('*/sales_order/pdfdocs'),
219
+ ));
220
+ return $this;
221
+ }
222
+
223
+ public function getRowUrl($row)
224
+ {
225
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
226
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
227
+ }
228
+ return false;
229
+ }
230
+
231
+ public function getGridUrl()
232
+ {
233
+ return $this->getUrl('*/*/grid', array('_current'=>true));
234
+ }
235
+ }
app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Invoice/Totals.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Block_Adminhtml_Sales_Order_Invoice_Totals extends Mage_Adminhtml_Block_Sales_Order_Invoice_Totals
4
+ {
5
+ /**
6
+ * Initialize order totals array
7
+ *
8
+ * @return Mage_Sales_Block_Order_Totals
9
+ */
10
+ protected function _initTotals()
11
+ {
12
+
13
+ parent::_initTotals();
14
+
15
+
16
+ $order = $this->getOrder();
17
+ //$id =$this->getSource()->getQuoteId();
18
+ $id = $order->getQuoteId();
19
+ $resource = Mage::getSingleton('core/resource');
20
+ $readConnection = $resource->getConnection('core_read');
21
+ $table = $resource->getTableName('sales/quote_address');
22
+ $query = 'SELECT beezup_fee FROM ' . $table . ' WHERE quote_id = '.$id.' and address_type = \'shipping\' LIMIT 1';
23
+ $fee = $readConnection->fetchOne($query);
24
+ parent::_initTotals();
25
+ $amount = 20;
26
+
27
+ if ($fee>0) {
28
+ $this->addTotalBefore(new Varien_Object(array(
29
+ 'code' => 'turnkeye_insurance',
30
+ 'value' => $fee,
31
+ 'base_value'=> $fee,
32
+ 'label' => "Frais de Gestion Cdiscount",
33
+ ), array('shipping', 'tax')));
34
+ }
35
+ $this->_totals['paid'] = new Varien_Object(array(
36
+ 'code' => 'paid',
37
+ 'strong' => true,
38
+ 'value' => $order->getTotalPaid() +$fee,
39
+ 'base_value'=> $order->getBaseTotalPaid() + $fee,
40
+ 'label' => $this->helper('sales')->__('Total Paid'),
41
+ 'area' => 'footer'
42
+ ));
43
+
44
+ $this->_totals['grand_total'] = new Varien_Object(array(
45
+ 'code' => 'grand_total',
46
+ 'strong' => true,
47
+ 'value' => $order->getGrandTotal() +$fee,
48
+ 'base_value'=> $order->getBaseGrandTotal() +$fee,
49
+ 'label' => $this->helper('sales')->__('Grand Total'),
50
+ 'area' => 'footer'
51
+ ));
52
+
53
+ // $this->setGrandTotal($this->getGrandTotal() + 20);
54
+ return $this;
55
+ }
56
+
57
+ }
app/code/community/BeezUp/Block/Adminhtml/Sales/Order/Totals.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals
4
+ {
5
+ /**
6
+ * Initialize order totals array
7
+ *
8
+ * @return Mage_Sales_Block_Order_Totals
9
+ */
10
+ protected function _initTotals()
11
+ {
12
+
13
+ $id =$this->getSource()->getQuoteId();
14
+ $fee = 0;
15
+ if(is_numeric($id) && $id > 0) {
16
+ $resource = Mage::getSingleton('core/resource');
17
+ $readConnection = $resource->getConnection('core_read');
18
+ $table = $resource->getTableName('sales/quote_address');
19
+ $query = 'SELECT beezup_fee FROM ' . $table . ' WHERE quote_id = '.$id.' and address_type = \'shipping\' LIMIT 1';
20
+ $fee = $readConnection->fetchOne($query);
21
+ }
22
+ parent::_initTotals();
23
+
24
+
25
+ if ($fee>0) {
26
+ $this->addTotalBefore(new Varien_Object(array(
27
+ 'code' => 'turnkeye_insurance',
28
+ 'value' => $fee,
29
+ 'base_value'=> $fee,
30
+ 'label' => 'Frais de Gestion Cdiscount',
31
+ ), array('shipping', 'tax')));
32
+ }
33
+ $this->_totals['paid'] = new Varien_Object(array(
34
+ 'code' => 'paid',
35
+ 'strong' => true,
36
+ 'value' => $this->getSource()->getTotalPaid() +$fee,
37
+ 'base_value'=> $this->getSource()->getBaseTotalPaid() + $fee,
38
+ 'label' => $this->helper('sales')->__('Total Paid'),
39
+ 'area' => 'footer'
40
+ ));
41
+
42
+ $this->_totals['grand_total'] = new Varien_Object(array(
43
+ 'code' => 'grand_total',
44
+ 'strong' => true,
45
+ 'value' => $this->getSource()->getGrandTotal() +$fee,
46
+ 'base_value'=> $this->getSource()->getBaseGrandTotal() +$fee,
47
+ 'label' => $this->helper('sales')->__('Grand Total'),
48
+ 'area' => 'footer'
49
+ ));
50
+
51
+ // $this->setGrandTotal($this->getGrandTotal() + 20);
52
+ return $this;
53
+ }
54
+
55
+ }
app/code/community/BeezUp/Block/Adminhtml/Sales/Order/View/Tab/Custom.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ///app/design/adminhtml/default/default/layout/ beezup_salestab.xml
3
+ //app\design\adminhtml\default\default\template/beezup/custom.phtml
4
+ class BeezUp_Block_Adminhtml_Sales_Order_View_Tab_Custom
5
+ extends Mage_Adminhtml_Block_Template
6
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
7
+ {
8
+ protected $_chat = null;
9
+
10
+ protected function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->setTemplate('beezup/custom.phtml');
14
+ }
15
+
16
+ public function getTabLabel() {
17
+ return $this->__('BeezUP Info');
18
+ }
19
+
20
+ public function getTabTitle() {
21
+ return $this->__('BeezUP Info');
22
+ }
23
+
24
+ public function canShowTab() {
25
+ return true;
26
+ }
27
+
28
+ public function isHidden() {
29
+ return false;
30
+ }
31
+
32
+ public function getOrder(){
33
+ return Mage::registry('current_order');
34
+ }
35
+
36
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Attributes.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Beezup_Block_Adminhtml_System_Config_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
3
+ {
4
+
5
+ protected $_addRowButtonHtml = array();
6
+ protected $_removeRowButtonHtml = array();
7
+
8
+ /**
9
+ * Returns html part of the setting
10
+ *
11
+ * @param Varien_Data_Form_Element_Abstract $element
12
+ * @return string
13
+ */
14
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
15
+ {
16
+
17
+
18
+
19
+ $this->setElement($element);
20
+
21
+
22
+ $repository = new BeezupRepository();
23
+ $stores = $repository->getStores();
24
+ $inc = 0;
25
+ $html = '';
26
+ foreach ($stores as $_eachStoreId => $val)
27
+ {
28
+ $html .= '<div id="attributes_template'.$inc.'" style="display:none">';
29
+ $html .= $this->_getRowTemplateHtml($_eachStoreId);
30
+ $html .= '</div>';
31
+ $html .= "<li style='margin-top:20px;'>".$val."</li>";
32
+ $html .= '<ul id="attributes_container'.$inc.'" >';
33
+ if ($this->_getValue('attributes/'.$_eachStoreId)) {
34
+ foreach ($this->_getValue('attributes/'.$_eachStoreId) as $i => $f) {
35
+ if ($i) {
36
+
37
+
38
+ $html .= $this->_getRowTemplateHtml($_eachStoreId, $i, $inc);
39
+
40
+ }
41
+ }
42
+ }
43
+ $html .= '</ul>';
44
+ $html .= $this->_getAddRowButtonHtml('attributes_container'.$inc,
45
+ 'attributes_template'.$inc, $this->__('Add New Attribute'));
46
+ $inc++; }
47
+
48
+
49
+ return $html;
50
+
51
+ }
52
+
53
+ /**
54
+ * Retrieve html template for setting
55
+ *
56
+ * @param int $rowIndex
57
+ * @return string
58
+ */
59
+ protected function _getRowTemplateHtml($storeid = "", $rowIndex = 0)
60
+ {
61
+ $html = '<li>';
62
+
63
+ $html .= '<div style="margin:5px 0 10px;">';
64
+
65
+ $attributes = $this->_getAttributes();
66
+
67
+ $html .= '<select style="width:70%;" name="'
68
+ . $this->getElement()->getName() . '[attributes]['.$storeid.'][]" '. $this->_getDisabled() . '/> ';
69
+
70
+ foreach ($attributes as $attribute){
71
+
72
+ IF($attribute['label']!=="" && !empty($attribute['label'])) {
73
+ $selected = "";
74
+
75
+ $datos = $this->_getValue('attributes/'.$storeid."/" . $rowIndex);
76
+ $data = explode("|" ,$datos);
77
+ $inc = 0;
78
+
79
+ if( $data[0]== $attribute['code'] && $data[1]==$storeid) {
80
+ $selected = "selected";
81
+ }
82
+
83
+ $html .= "<option value='".$attribute['code']."|".$storeid."' ".$selected.">".$attribute['label']."</option>";
84
+
85
+ }
86
+
87
+ }
88
+
89
+ $html .= "</select>";
90
+ $html .= $this->_getRemoveRowButtonHtml();
91
+ $html .= '</div>';
92
+ $html .= '</li>';
93
+
94
+ return $html;
95
+ }
96
+
97
+ public function _getAttributes() {
98
+ $atributos = array();
99
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
100
+ ->getItems();
101
+ foreach ($attributes as $attribute){
102
+
103
+ $atributos[] = array("code" => $attribute->getAttributecode(), "label" =>$attribute->getFrontendLabel()) ;
104
+
105
+
106
+
107
+ }
108
+
109
+ foreach ($atributos as $key => $att) {
110
+ if($att['code'] == "sku") {
111
+ unset($atributos[$key]); // unset the $array with id $id
112
+ array_unshift($atributos, $att); // unshift the array with $val to push in the beginning of array
113
+
114
+
115
+ // $atributos = array_merge(array($key => $att), $atributos);
116
+ }
117
+ }
118
+
119
+ return $atributos;
120
+ }
121
+
122
+
123
+ protected function _getDisabled()
124
+ {
125
+ return $this->getElement()->getDisabled() ? ' disabled' : '';
126
+ }
127
+
128
+ protected function _getValue($key)
129
+ {
130
+ return $this->getElement()->getData('value/' . $key);
131
+ }
132
+
133
+ protected function _getSelected($key, $value)
134
+ {
135
+ return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
136
+ }
137
+
138
+ protected function _getAddRowButtonHtml($container, $template, $title='Add')
139
+ {
140
+ if (!isset($this->_addRowButtonHtml[$container])) {
141
+ $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
142
+ ->setType('button')
143
+ ->setClass('add ' . $this->_getDisabled())
144
+ ->setLabel($this->__($title))
145
+ ->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
146
+ ->setDisabled($this->_getDisabled())
147
+ ->toHtml();
148
+ }
149
+ return $this->_addRowButtonHtml[$container];
150
+ }
151
+
152
+ protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
153
+ {
154
+ if (!$this->_removeRowButtonHtml) {
155
+ $this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
156
+ ->setType('button')
157
+ ->setClass('delete v-middle ' . $this->_getDisabled())
158
+ ->setLabel($this->__($title))
159
+ ->setOnClick("Element.remove($(this).up('" . $selector . "'))")
160
+ ->setDisabled($this->_getDisabled())
161
+ ->toHtml();
162
+ }
163
+ return $this->_removeRowButtonHtml;
164
+ }
165
+
166
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Button.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Beezup_Block_Adminhtml_System_Config_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('beezup/system/config/button.phtml');
9
+ }
10
+
11
+ /**
12
+ * Return element html
13
+ *
14
+ * @param Varien_Data_Form_Element_Abstract $element
15
+ * @return string
16
+ */
17
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
18
+ {
19
+
20
+ return $this->_toHtml();
21
+ }
22
+
23
+ /**
24
+ * Return ajax url for button
25
+ *
26
+ * @return string
27
+ */
28
+ public function getAjaxCheckUrl()
29
+ {
30
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_beezup/check');
31
+ }
32
+
33
+ /**
34
+ * Generate button html
35
+ *
36
+ * @return string
37
+ */
38
+ public function getButtonHtml()
39
+ {
40
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'atwixtweaks_button',
43
+ 'label' => $this->helper('adminhtml')->__('Check'),
44
+ 'onclick' => 'javascript:check(); return false;'
45
+ ));
46
+
47
+ return $button->toHtml();
48
+ }
49
+
50
+
51
+
52
+
53
+
54
+ }
55
+
56
+
app/code/community/BeezUp/Block/Adminhtml/System/Config/Childgroup.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beezup_Block_Adminhtml_System_Config_Childgroup extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $this->setElement($element);
9
+ $html = "<style>#row_".$this->getElement()->getId()." {
10
+ background:#6F8992;
11
+ }
12
+ #row_".$this->getElement()->getId()." td label {
13
+ color:white;
14
+ }
15
+ #row_".$this->getElement()->getId()." td .scope-label {
16
+ display:none;
17
+ }
18
+ #beezup_marketplace table {margin-top: -30px;}
19
+ </style>
20
+ <script>
21
+ var theParent = document.getElementById('row_".$this->getElement()->getId()."');
22
+ var table_row = document.createElement('tr');
23
+ table_row.innerHTML = '<td style=\'height:25px;\'></td>';
24
+ theParent.parentNode.insertBefore(table_row, theParent);
25
+
26
+ </script>
27
+ ";
28
+ return $html;
29
+
30
+ }
31
+
32
+
33
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Credentials.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beezup_Block_Adminhtml_System_Config_Credentials extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $this->setElement($element);
9
+ $helper = Mage::helper('beezup');
10
+ $status = $helper->getConfig('beezup/marketplace/connection_status');
11
+ $lang = $this->__("NOT OK");
12
+ $color = "red";
13
+ $width = "45px";
14
+ $css_style = "";
15
+ if( $this->getElement()->getValue() == 1) {
16
+ $lang = $this->__("OK");
17
+ $color = "green";
18
+ $width = "18px";
19
+ } else {
20
+ $css_style = '<style>#row_beezup_marketplace_cron_call,
21
+ #row_beezup_marketplace_cron_url,
22
+ #row_beezup_marketplace_sync_status,
23
+ #row_beezup_marketplace_status_mapping,
24
+ #row_beezup_marketplace_status_new,
25
+ #row_beezup_marketplace_status_progress,
26
+ #row_beezup_marketplace_status_closed,
27
+ #row_beezup_marketplace_status_aborted,
28
+ #row_beezup_marketplace_status_shipped,
29
+ #row_beezup_marketplace_status_cancelled,
30
+ #row_beezup_marketplace_stores_mapping,
31
+ #row_beezup_marketplace_stores,
32
+ #row_beezup_marketplace_field_mapping,
33
+ #row_beezup_marketplace_attributes,
34
+ #row_beezup_marketplace_log_block,
35
+ #row_beezup_marketplace_log,
36
+ #marketPlaceLogBlock {
37
+ display:none;
38
+ }</style>';
39
+
40
+ }
41
+
42
+ return $css_style."<div style='width:". $width.";padding:7px;height:17px;border-radius:6px;cursor:pointer;background:".$color."; color:white;'>".$lang."</div><input id='".$this->getElement()->getId() ."' type='hidden' name='".$this->getElement()->getName() ."' value='". $this->getElement()->getValue()."' />";
43
+
44
+ }
45
+
46
+
47
+
48
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Cron.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beezup_Block_Adminhtml_System_Config_Cron extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $sPhpBinary = defined('PHP_BINARY') ? PHP_BINARY : PHP_BINDIR;
9
+ $sPhpExecutable = ($sPhpBinary ? rtrim($sPhpBinary, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : '' ) . 'php' . (DIRECTORY_SEPARATOR == '\\' ? '.exe' : '');
10
+ return "<p style='width:550px;background: #EFECEC;'><code>".sprintf('*/10 * * * * %s %s', $sPhpExecutable, Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_SECURE_URL) . 'beezup/cron/execute')."</code></p>";
11
+
12
+ }
13
+
14
+
15
+
16
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Filter.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Beezup_Block_Adminhtml_System_Config_Filter extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $helper = Mage::helper('beezup');
8
+ $token = $helper->getConfig('beezup/marketplace/usertoken');
9
+ if($token == 2) {
10
+ return "Hola Mundo";
11
+ } else {
12
+ return "<style>#row_beezup_marketplace_new_value {display:none;}</style>";
13
+ }
14
+ $date = new Varien_Data_Form_Element_Date;
15
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
16
+
17
+ $data = array(
18
+ 'name' => $element->getName(),
19
+ 'html_id' => $element->getId(),
20
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
21
+ );
22
+ $date->setData($data);
23
+ $date->setValue($element->getValue(), $format);
24
+ $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
25
+ $date->setClass($element->getFieldConfig()->validate->asArray());
26
+ $date->setForm($element->getForm());
27
+
28
+ return $date->getElementHtml();
29
+ }
30
+ */
31
+
32
+
33
+ protected $_addRowButtonHtml = array();
34
+ protected $_removeRowButtonHtml = array();
35
+
36
+ /**
37
+ * Returns html part of the setting
38
+ *
39
+ * @param Varien_Data_Form_Element_Abstract $element
40
+ * @return string
41
+ */
42
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
43
+ {
44
+
45
+ $helper = Mage::helper('beezup');
46
+ $token = $helper->getConfig('beezup/marketplace/usertoken');
47
+ if(!empty($token)) {
48
+ return "<style>#row_".$element->getId()." {display:none;}</style>";
49
+ } else {
50
+
51
+
52
+
53
+ $this->setElement($element);
54
+
55
+ $html = '<div id="emailblocker_addresses_template" style="display:none">';
56
+ $html .= $this->_getRowTemplateHtml();
57
+ $html .= '</div>';
58
+
59
+ $html .= '<ul id="emailblocker_addresses_container">';
60
+ if ($this->_getValue('addresses')) {
61
+ foreach ($this->_getValue('addresses') as $i => $f) {
62
+ if ($i) {
63
+ $html .= $this->_getRowTemplateHtml($i);
64
+ }
65
+ }
66
+ }
67
+ $html .= '</ul>';
68
+ $html .= $this->_getAddRowButtonHtml('emailblocker_addresses_container',
69
+ 'emailblocker_addresses_template', $this->__('Add New Attribute'));
70
+
71
+ return $html;
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Retrieve html template for setting
77
+ *
78
+ * @param int $rowIndex
79
+ * @return string
80
+ */
81
+ protected function _getRowTemplateHtml($rowIndex = 0)
82
+ {
83
+ $html = '<li>';
84
+
85
+ $html .= '<div style="margin:5px 0 10px;">';
86
+
87
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
88
+ ->getItems();
89
+ // $html .= '<select style="width:100px;" name="'
90
+ // . $this->getElement()->getName() . '[addresses][]" value="'
91
+ // . $this->_getValue('addresses/' . $rowIndex) . '" ' . $this->_getDisabled() . '/> ';
92
+
93
+ $html .= '<select style="width:70%;" name="'
94
+ . $this->getElement()->getName() . '[addresses][]" '. $this->_getDisabled() . '/> ';
95
+
96
+ foreach ($attributes as $attribute){
97
+ $selected = "";
98
+ if(!empty($attribute->getFrontendLabel()) && $attribute->getFrontendLabel() !== "") {
99
+ if($this->_getValue('addresses/' . $rowIndex) == $attribute->getAttributecode()) {
100
+ $selected = "selected";
101
+ }
102
+ $html .= "<option value='".$attribute->getAttributecode()."' ".$selected.">".$attribute->getFrontendLabel()."</option>";
103
+ }
104
+ // echo $attribute->getAttributecode();
105
+
106
+ // echo $attribute->getFrontendLabel();
107
+ }
108
+
109
+ $html .= "</select>";
110
+ $html .= $this->_getRemoveRowButtonHtml();
111
+ $html .= '</div>';
112
+ $html .= '</li>';
113
+
114
+ return $html;
115
+ }
116
+
117
+ protected function _getDisabled()
118
+ {
119
+ return $this->getElement()->getDisabled() ? ' disabled' : '';
120
+ }
121
+
122
+ protected function _getValue($key)
123
+ {
124
+ return $this->getElement()->getData('value/' . $key);
125
+ }
126
+
127
+ protected function _getSelected($key, $value)
128
+ {
129
+ return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
130
+ }
131
+
132
+ protected function _getAddRowButtonHtml($container, $template, $title='Add')
133
+ {
134
+ if (!isset($this->_addRowButtonHtml[$container])) {
135
+ $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
136
+ ->setType('button')
137
+ ->setClass('add ' . $this->_getDisabled())
138
+ ->setLabel($this->__($title))
139
+ ->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
140
+ ->setDisabled($this->_getDisabled())
141
+ ->toHtml();
142
+ }
143
+ return $this->_addRowButtonHtml[$container];
144
+ }
145
+
146
+ protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
147
+ {
148
+ if (!$this->_removeRowButtonHtml) {
149
+ $this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
150
+ ->setType('button')
151
+ ->setClass('delete v-middle ' . $this->_getDisabled())
152
+ ->setLabel($this->__($title))
153
+ ->setOnClick("Element.remove($(this).up('" . $selector . "'))")
154
+ ->setDisabled($this->_getDisabled())
155
+ ->toHtml();
156
+ }
157
+ return $this->_removeRowButtonHtml;
158
+ }
159
+
160
+
161
+ }
162
+
163
+
app/code/community/BeezUp/Block/Adminhtml/System/Config/Log.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beezup_Block_Adminhtml_System_Config_Log extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+
9
+ $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
10
+ // $log1 = file_get_contents();
11
+ $ret = array();
12
+ if (file_exists($logDir."/log.txt")) {
13
+ $f = fopen($logDir."/log.txt", 'r');
14
+
15
+ if ($f) {
16
+ while (!feof($f)) {
17
+ $ret[] = fgetcsv($f, 0, '|');
18
+ }
19
+ fclose($f);
20
+ }
21
+ }
22
+ array_slice(array_reverse($ret), 1, 10);
23
+
24
+ return $this->_getTable($ret);
25
+
26
+ }
27
+
28
+
29
+ public function _getTable($data) {
30
+ $url = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB, true );
31
+ $html = "<td></td><td></td><tr></tr></tbody></table>
32
+
33
+ <div class='grid' style=' height: 400px;overflow-y: scroll;padding: 16px;border: 3px solid #e6e6e6;' id='marketPlaceLogBlock'>";
34
+ $html .= '<p>'. Mage::helper('beezup')->__('For full logs see here:').' <a href="'.$url .'beezup/log/load" target="_blank">'.$url .'beezup/log/load</a></p>';
35
+ $html .= "<table class='data' style='margin-top:0px;'>";
36
+ $html .= "<tr class='headings'>";
37
+ $html .= '<th><span class="nobr">Time</span></th>';
38
+ $html .= '<th><span class="nobr">Type</span></th>';
39
+ $html .= '<th><span class="nobr">Order Id</span></th>';
40
+ $html .= '<th><span class="nobr">Message</span></th>';
41
+ $html .= "</tr>";
42
+ $html .= "<tbody>";
43
+ foreach($data as $d) {
44
+ $background = " background: rgb(240, 184, 184)";
45
+ if($d[1] == " INFO " ) {
46
+ $background = " background: rgb(210, 227, 253)";
47
+ }
48
+ $orderId = (isset($d[3])) ? $d[2] : "";
49
+ $message = (isset($d[3])) ? $d[3] : $d[2];
50
+ $html .= "<tr class='even pointer' style='".$background."'>";
51
+ $html .= "<td>".$d[0]."</td>";
52
+ $html .= "<td>".$d[1]."</td>";
53
+ $html .= "<td>".$orderId."</td>";
54
+ $html .= "<td>".$message."</td>";
55
+ $html .= "</tr>";
56
+
57
+ }
58
+
59
+ $html .= "<tbody>";
60
+ $html .= '</table>';
61
+ $html .= "</div>";
62
+
63
+ return $html;
64
+ }
65
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Manualcron.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beezup_Block_Adminhtml_System_Config_Manualcron extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $url = Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_SECURE_URL) . 'beezup/cron/execute';
9
+ return "<a href='".$url."' target='_blank'>".$url."</a>";
10
+ }
11
+
12
+
13
+
14
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Stores.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once dirname ( __FILE__ ) . "/../../../../lib/bootstrap.php";
3
+ require_once dirname ( __FILE__ ) . "/../../../../lib/BeezupRepository.php";
4
+ class Beezup_Block_Adminhtml_System_Config_Stores extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
+ {
6
+
7
+
8
+
9
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
10
+ {
11
+ $this->setElement($element);
12
+ $html = "<div id='".$this->getElement()->getId()."'>";
13
+ $repository = new BeezupRepository();
14
+ $stores = $repository->getStores();
15
+ $i = 0;
16
+ foreach ($stores as $_eachStoreId => $val)
17
+ {
18
+ $html .= '<li>';
19
+ $html .= '<div style="margin:5px 0 10px;">';
20
+
21
+ $html .= "<label>".$val."</label>";
22
+ $html .= $this->_getBeezupStores( $_eachStoreId,$i);
23
+ $html .= '</div>';
24
+ $html .= '</li>';
25
+ $i++;
26
+ }
27
+ $html .= "</div>";
28
+ return $html;
29
+
30
+
31
+ }
32
+
33
+
34
+ protected function _getBeezupStores($bzupStore, $rowIndex =0)
35
+ {
36
+ $html = "";
37
+
38
+ $allStores = Mage::app()->getStores();
39
+ $html .= '<select style="width:100%;" name="'.$this->getElement()->getName() . '[stores]['.$bzupStore.']" /> ';
40
+ $html .= "<option value='0'>".$this->__("Select Value...")."</option>";
41
+ foreach($allStores as $key => $store) {
42
+ $selected = "";
43
+ $_storeName = Mage::app()->getStore($key)->getName();
44
+ $_storeId = Mage::app()->getStore($key)->getId();
45
+ $value = $this->_getValue('stores/' . $bzupStore);
46
+ if($value ==$_storeId) {
47
+ $selected = "selected";
48
+ }
49
+ $html .= "<option value='".$_storeId."' ".$selected.">".$_storeName."</option>";
50
+ }
51
+
52
+
53
+ $html .= "</select>";
54
+ $html .= '</div>';
55
+ $html .= '</li>';
56
+
57
+ return $html;
58
+ }
59
+
60
+ protected function _getValue($key)
61
+ {
62
+ return $this->getElement()->getData('value/' . $key);
63
+ }
64
+
65
+
66
+
67
+
68
+
69
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Syncstatus.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beezup_Block_Adminhtml_System_Config_Syncstatus extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $this->setElement($element);
9
+ $helper = Mage::helper('beezup');
10
+ $status = $helper->getConfig('beezup/marketplace/connection_status');
11
+ $lang = $this->__("Not Syncing");
12
+ $color = "#666";
13
+ $width = "67px";
14
+ if( $this->getElement()->getValue() == 1) {
15
+ $lang = $this->__("Syncing");
16
+ $color = "green";
17
+ $width = "45px";
18
+ }
19
+
20
+ return "<div style='width:". $width.";padding:7px;height:17px;border-radius:6px;cursor:pointer;background:".$color."; color:white;'>".$lang."</div><input id='".$this->getElement()->getId() ."' type='hidden' name='".$this->getElement()->getName() ."' value='". $this->getElement()->getValue()."' />";
21
+
22
+ }
23
+
24
+
25
+
26
+ }
app/code/community/BeezUp/Block/Adminhtml/System/Config/Time.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beezup_Block_Adminhtml_System_Config_Time extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $this->setElement($element);
9
+ $html = gmdate("Y-m-d H:i:s", $this->getElement()->getValue())." (UTC Time) <a class='form-button' style='padding:5px;margin-left:10px;'onclick='showInput()'>".$this->__("Change")."</a><br>";
10
+ $html .= "<input type='text' class='input-text' style='margin-top:7px;display:none;' id='".$this->getElement()->getId()."' name='".$this->getElement()->getName()."' value='".gmdate("Y-m-d H:i:s", $this->getElement()->getValue())."'/>";
11
+ $html .= '<script>
12
+ function showInput() {
13
+ var contentId = document.getElementById("'.$this->getElement()->getId().'");
14
+ contentId.style.display == "block" ? contentId.style.display = "none" :
15
+ contentId.style.display = "block";
16
+ }
17
+ </script>
18
+ ';
19
+ return $html;
20
+ }
21
+
22
+
23
+
24
+ }
app/code/community/BeezUp/Block/Order.php ADDED
@@ -0,0 +1,1143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once dirname ( __FILE__ ) . "/../lib/KLogger.php";
3
+ require_once dirname ( __FILE__ ) . "/../lib/bootstrap.php";
4
+ require_once dirname ( __FILE__ ) . "/../lib/BeezupRepository.php";
5
+ require_once dirname ( __FILE__ ) . "/../lib/BeezupMageOrders.php";
6
+
7
+ class Beezup_Block_Order extends Mage_core_block_text {
8
+
9
+ protected $repository = null;
10
+ protected $oOrderService;
11
+ public $log = null;
12
+ public $log2 = null;
13
+ public $orderid = "";
14
+ public $debug = false;
15
+ public function executeCron() {
16
+
17
+
18
+
19
+ set_time_limit(0);
20
+ $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
21
+ if(file_exists($logDir."log2.txt")) {
22
+ if(filesize($logDir."/log2.txt") >=3000000) {
23
+ unlink($logDir."log2.txt");
24
+ }
25
+ }
26
+
27
+ $sync_end_date = new DateTime ( 'now', new DateTimeZone ( 'UTC' ));
28
+ $helper = Mage::helper('beezup');
29
+ $sync_status = $helper->getConfig('beezup/marketplace/sync_status');
30
+ $debug_mode = $helper->getConfig('beezup/marketplace/debug_mode');
31
+ if($debug_mode==1) {
32
+ $this->debug = true;
33
+ }
34
+
35
+ if($sync_status!==1) {
36
+ $configModel = Mage::getModel('core/config');
37
+ $configModel->saveConfig('beezup/marketplace/sync_status',1);
38
+
39
+
40
+
41
+ unlink($logDir."log.txt");
42
+ $this->log = new KLogger ( $logDir."log.txt" , KLogger::DEBUG );
43
+ $this->log2 = new KLogger ( $logDir."log2.txt" , KLogger::DEBUG );
44
+ $this->debugLog("Initializing OM Importation");
45
+ $shiiping_disabled = Mage::getStoreConfig('carriers/flatrate/active');
46
+ if($shiiping_disabled == 0) {
47
+ $this->enableFlatRate(true);
48
+ }
49
+ $this->getOrderList();
50
+ if($shiiping_disabled == 0) {
51
+ $this->enableFlatRate(false);
52
+ }
53
+ $this->repository->updateLastSynchronizationDate( $sync_end_date);
54
+ $this->orderid = "";
55
+ $this->debugLog("OM Importation finalized succesfully");
56
+ $configModel->saveConfig('beezup/marketplace/sync_status',0);
57
+ echo "OM Importation finalized succesfully";
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+ } else {
67
+
68
+ echo "Order Importation is already being executed";
69
+ }
70
+
71
+ }
72
+
73
+
74
+ public function getLog() {
75
+ $logDir = Mage::getModuleDir('', 'BeezUp')."/log/";
76
+ $log1 = file_get_contents($logDir."/log2.txt");
77
+
78
+ echo "<pre>";
79
+ print_r($log1);
80
+ echo "</pre>";
81
+
82
+ }
83
+
84
+ public function getOrderList($orderList = null) {
85
+ if($orderList == null) {
86
+ $data = $this->createRepository()->createOrderListRequest();
87
+ $oRequest = $this->getOrderService()->getClientProxy()->getOrderList($data);
88
+ $orderList = $oRequest->getResult();
89
+ }
90
+ $oPagination = $orderList->getPaginationResult();
91
+ if(!empty($oPagination)) {
92
+ $oLinksTotal = $oPagination->getLinks();
93
+ } else {
94
+ $configModel = Mage::getModel('core/config');
95
+ $configModel->saveConfig('beezup/marketplace/sync_status',0);
96
+ die("No more orders to import");
97
+ }
98
+
99
+ //$header = $orderList->getOrderHeaders();
100
+ foreach($orderList->getOrderHeaders() as $order) {
101
+
102
+
103
+ $order_status = $order->getBeezupOrderState();
104
+ $orderLinks = $order->getLinks();
105
+ $etag = $order->getETag();
106
+ $beezup_order_id = $order->getBeezupOrderUUID();
107
+ // print_r($order);
108
+ // print_r($orderLinks[0]);
109
+ $account_id = $order->getAccountId();
110
+ $orderdata = $this->getOrderService()->getClientProxy()->getOrderByLink($orderLinks[0]);
111
+ $final_order = $orderdata->getResult();
112
+ // $order_items = $final_order->getOrderItems();
113
+ $marketplace_mod_date = $order->getMarketPlaceLastModificationUtcDate();
114
+ $purchase_date = $order->getPurchaseUtcDate();
115
+ $last_mod_date = $order->getLastModificationUtcDate();
116
+ $orderid = $final_order->getOrderMarketPlaceOrderId();
117
+ $this->orderid = $orderid;
118
+ //customer Info
119
+ $order_address = $final_order->getOrderBuyerAddressCity();
120
+ $order_country = $final_order->getOrderBuyerAddressCountryName();
121
+ $order_country_iso = $final_order->getOrderBuyerAddressCountryIsoCodeAlpha2();
122
+ $order_address = $this->getBeezupBuyerAddress($final_order);
123
+ $order_postalCode = $final_order->getOrderBuyerAddressPostalCode();
124
+ $order_customer = $final_order->getOrderBuyerName();
125
+ $order_customer_email = $final_order->getOrderBuyerEmail();
126
+ $order_customer_phone = $final_order->getOrderBuyerPhone();
127
+ $order_customer_mobile = $final_order->getOrderBuyerMobilePhone();
128
+ $order_comment = $final_order->getOrderComment();
129
+ $order_company = $final_order->getOrderBuyerCompanyName();
130
+ $order_city = $final_order->getOrderBuyerAddressCity();
131
+ $order_region = $final_order->getOrderBuyerStateOrRegion();
132
+
133
+ //shipping information
134
+ $shipping_city = $final_order->getOrderShippingAddressCity();
135
+ $shipping_country = $final_order->getOrderShippingAddressCountryName();
136
+ $shipping_country_iso = $final_order->getOrderShippingAddressCountryIsoCodeAlpha2();
137
+ $shipping_address = $this->getBeezupShippingAddress($final_order);
138
+ $shipping_name = $final_order->getOrderShippingAddressName();
139
+ $shipping_postalCode = $final_order->getOrderShippingAddressPostalCode();
140
+ $shipping_email = $final_order->getOrderShippingEmail();
141
+ $shipping_phone = $final_order->getOrderShippingPhone();
142
+ $shipping_mobile = $final_order->getOrderShippingMobilePhone();
143
+ $shipping_company = $final_order->getOrderShippingCompanyName();
144
+ $shipping_region = $final_order->getOrderShippingAddressStateOrRegion();
145
+ $order_currency_code = $final_order->getOrderCurrencyCode();
146
+ //order Info
147
+ $order_totalPrice = $final_order->getOrderTotalPrice();
148
+ $order_shippingPrice = $final_order->getOrderShippingPrice();
149
+
150
+ $name_parts = explode(" ", $order_customer);
151
+ $order_first_name = array_shift( $name_parts);
152
+ $order_last_name = implode(" ", $name_parts);
153
+
154
+
155
+ $name_parts = explode(" ", $shipping_name);
156
+ $shipping_first_name = array_shift( $name_parts);
157
+ $shipping_last_name = implode(" ", $name_parts);
158
+
159
+
160
+ //marketplace information
161
+ $marketplace_order_id = $order->getMarketPlaceOrderId();
162
+ $marketplace = $final_order->getMarketPlaceTechnicalCode();
163
+ $this->debugLog("Initializing Order - Link: ".$orderLinks[0]->getHref());
164
+ //productInfo
165
+ if(!$this->checkEtagExists($etag)) {
166
+
167
+ $mage_productIds = $this->prescanOrder($final_order);
168
+ if($mage_productIds) {
169
+ $order_data = array(
170
+ "etag" => $etag,
171
+ "account_id" => $account_id,
172
+ "marketplace_mod_date" => $marketplace_mod_date,
173
+ "purchase_date" => $purchase_date ,
174
+ "last_mod_date" => $last_mod_date ,
175
+ "beezup_order_id" => $beezup_order_id,
176
+ "order_status" => $order_status,
177
+ "products" => $mage_productIds['products'],
178
+ "storeid" => $mage_productIds['store'],
179
+ "order_currency" => $order_currency_code ,
180
+ "order_address" => $order_adress,
181
+ "order_country" => $order_country,
182
+ "order_country_iso" => $order_country_iso ,
183
+ "order_address" => $order_address ,
184
+ "order_postalCode" => $order_postalCode ,
185
+ "order_customer" => $order_first_name ,
186
+ "order_lastname" => $order_last_name ,
187
+ "order_customer_email" => $order_customer_email ,
188
+ "order_customer_phone" => $this->getPhone($order_customer_phone, $order_customer_mobile) ,
189
+ "order_comment" => $order_comment ,
190
+ "order_company" => $order_company ,
191
+ "shipping_city" => $shipping_city ,
192
+ "shipping_country" => $shipping_country ,
193
+ "shipping_country_iso" => $shipping_country_iso ,
194
+ "shipping_address" => $shipping_address ,
195
+ "shipping_name" => $shipping_first_name ,
196
+ "shipping_lastname" => $shipping_last_name ,
197
+ "shipping_postalCode" => $shipping_postalCode ,
198
+ "shipping_region" =>$shipping_region,
199
+ "shipping_email" => $shipping_email ,
200
+ "shipping_phone" => $this->getPhone($shipping_phone, $shipping_mobile) ,
201
+ "shipping_company" => $shipping_company ,
202
+ "order_totalPrice" => $order_totalPrice ,
203
+ "order_shippingPrice" => $order_shippingPrice ,
204
+ "order_city" => $order_city,
205
+ "order_region" => $order_region,
206
+ "marketplace_order_id" => $marketplace_order_id,
207
+ "marketplace" => $marketplace,
208
+ "discounts" => $mage_productIds['discounts']
209
+ );
210
+
211
+
212
+
213
+ //check if order exists
214
+ $Mageorder = $this->loadMageOrder();
215
+ if ($Mageorder) {
216
+ //if order exists
217
+ $this->updateEtag($etag);
218
+ $this->updateBilling($Mageorder, $order_data );
219
+ $this->updateBeezupInfoTab($Mageorder, $final_order, $order_data);
220
+ $this->debugLog("Order Already exists Mage Order ID: " .$Mageorder->getId());
221
+ $status1 = $Mageorder->getStatusLabel();
222
+ $status = $this->getStatus($status1);
223
+ if($status !== $order_status) {
224
+ //if order exits and status has changed we update order status
225
+ $this->debugLog("Updating Order Status from: ".$status1." to: ".$order_status );
226
+ $this->setStatus( $order_status, $Mageorder);
227
+ }
228
+
229
+ $id_order = $Mageorder->getId();
230
+ $BeezupMageOrder = new BeezupMageOrders($id_order);
231
+ $BeezupMageOrder->setData(array("shipping" =>(float) $order_data['order_shippingPrice']));
232
+ $BeezupMageOrder->updateShippingInfo();
233
+ } else {
234
+ //if not we create order
235
+
236
+
237
+ $this->debugLog("Generating Order");
238
+ $this->addOrder($order_data,$final_order );
239
+
240
+
241
+ }
242
+
243
+
244
+ } else {
245
+ //order could not be imported
246
+
247
+
248
+ }
249
+
250
+
251
+ } else {
252
+ //etag has not changed
253
+ $this->debugLog("Order Etag has not changed");
254
+
255
+ }
256
+
257
+ }
258
+
259
+ if(!empty($oLinksTotal)) {
260
+ //we check if there is next link and get next orders
261
+ foreach($oLinksTotal as $link) {
262
+ if( $link->getRel() == "next") {
263
+
264
+ $this->log->LogInfo("Initializing New Order List ->". $link->getHref());
265
+ $this->log2->LogInfo("Initializing New Order List ->". $link->getHref());
266
+ $oRequest = $this->getOrderService()->getClientProxy()->getOrderListByLink($link);
267
+ $orderList = $oRequest->getResult();
268
+ $this->getOrderList($orderList);
269
+ }
270
+
271
+ }
272
+
273
+
274
+
275
+ }
276
+
277
+
278
+ }
279
+
280
+ public function updateBeezupInfoTab($order, $oLink, $data) {
281
+ $beezup_last_modification_date = $oLink->getOrderLastModificationUtcDate();
282
+ $beezup_last_modification_date = $beezup_last_modification_date->date;
283
+ $beezup_marketplace_last_modification_date = $oLink->getOrderMarketPlaceLastModificationUtcDate();
284
+ $beezup_marketplace_last_modification_date = $beezup_marketplace_last_modification_date->date;
285
+ $beezup_comission = $oLink->getOrderTotalCommission()." ".$data['order_currency'];
286
+ $tot_comm = $oLink->getOrderTotalCommission();
287
+ if(empty($tot_comm ) || $tot_comm == 0) {
288
+ $beezup_comission = 0;
289
+ }
290
+ $updateData = array("beezup_status" => $data['order_status'],
291
+ "beezup_last_modification_date" => $beezup_last_modification_date,
292
+ "beezup_marketplace_last_modification_date" => $beezup_marketplace_last_modification_date ,
293
+ "beezup_total_paid" => $oLink->getOrderTotalPrice()." ".$data['order_currency'],
294
+ "beezup_comission" => $beezup_comission,
295
+ "beezup_marketplace_status" => $oLink->getOrderStatusMarketPlaceStatus());
296
+ $orderId = $order->getId();
297
+ $beezupMageOrder = new BeezupMageOrders($orderId);
298
+ $beezupMageOrder->setData($updateData);
299
+ $beezupMageOrder->updateBeezupInfo();
300
+
301
+
302
+ }
303
+
304
+ public function getPhone($phone, $phone2) {
305
+ $retorno = "";
306
+ if(!empty($phone) && $phone !== "") {
307
+ $retorno .= $phone;
308
+ }
309
+ if(!empty($phone2) && $phone2 !=="") {
310
+ if(empty($phone) || $phone == "") {
311
+ $retorno = $phone2;
312
+
313
+ } else {
314
+ $retorno .= " - ".$phone2;
315
+ }
316
+ }
317
+ return $retorno;
318
+ }
319
+
320
+
321
+ public function getBeezupBuyerAddress($order) {
322
+ $add1=$order->getOrderBuyerAddressLine1();
323
+ $add2=$order->getOrderBuyerAddressLine2();
324
+ $add3=$order->getOrderBuyerAddressLine3();
325
+ $retorno = "";
326
+ if(!empty($add1)) {
327
+ $retorno = $order->getOrderBuyerAddressLine1();
328
+ }
329
+ if(!empty($add2)) {
330
+ if(empty($add1)) {
331
+ $retorno .= $order->getOrderBuyerAddressLine2();
332
+ } else {
333
+ $retorno .= " - ". $order->getOrderBuyerAddressLine2();
334
+ }
335
+ }
336
+ if(!empty($add3)){
337
+ if(empty($add1) && empty($add2)) {
338
+ $retorno .= $order->getOrderBuyerAddressLine3();
339
+ } else {
340
+ $retorno .= " - ". $order->getOrderBuyerAddressLine3();
341
+ }
342
+ }
343
+ return $retorno;
344
+ }
345
+
346
+
347
+ public function getBeezupShippingAddress($order) {
348
+ $add1 = $order->getOrderShippingAddressLine1();
349
+ $add2 = $order->getOrderShippingAddressLine2();
350
+ $add3=$order->getOrderBuyerAddressLine3();
351
+ $retorno = "";
352
+ if(!empty($add1 )) {
353
+ $retorno = $order->getOrderShippingAddressLine1();
354
+ }
355
+ if(!empty($add2)) {
356
+ if(empty($add1)) {
357
+ $retorno .= $order->getOrderShippingAddressLine2();
358
+ } else {
359
+ $retorno .= " - ". $order->getOrderShippingAddressLine2();
360
+ }
361
+ }
362
+ if(!empty($add3)){
363
+ if(empty($add1) && empty($add2)) {
364
+ $retorno .= $order->getOrderShippingAddressLine3();
365
+ } else {
366
+ $retorno .= " - ". $order->getOrderShippingAddressLine3();
367
+ }
368
+ }
369
+ return $retorno;
370
+ }
371
+
372
+ public function checkEtagExists($etag) {
373
+ $resource = Mage::getSingleton('core/resource');
374
+ $readConnection = $resource->getConnection('core_read');
375
+ $table = $resource->getTableName('sales/order_grid');
376
+ $query = 'SELECT increment_id FROM ' . $table . ' WHERE beezup_etag = \''
377
+ . $etag . '\' LIMIT 1';
378
+ $order = $readConnection->fetchOne($query);
379
+ if($order && !empty($order)) {
380
+ return true;
381
+ }
382
+ return false;
383
+
384
+ }
385
+
386
+
387
+ public function updateEtag($etag) {
388
+ $this->debugLog("Updating Etag");
389
+ $resource = Mage::getSingleton('core/resource');
390
+ $writeConnection = $resource->getConnection('core_write');
391
+ $table = $resource->getTableName('sales/order_grid');
392
+ $query = "UPDATE {$table} SET beezup_etag = '{$etag}' where beezup_market_order_id = '{$this->orderid}' ";
393
+ $writeConnection->query($query);
394
+
395
+ }
396
+
397
+
398
+
399
+ public function updateBilling($order, $data) {
400
+
401
+
402
+ $addressData = array(
403
+ 'billing_firstname' => ($data['order_customer']) ? $data['order_customer'] : "empty",
404
+ 'billing_lastname' => ($data['order_lastname']) ? $data['order_lastname'] : "empty",
405
+ 'billing_street' => ($data['order_address']) ? $data['order_address'] : "empty",
406
+ 'billing_city' => ($data['order_city']) ? $data['order_city'] : "empty",
407
+ 'billing_postcode' => ($data['order_postalCode']) ? $data['order_postalCode'] : "empty",
408
+ 'billing_telephone' => ($data['order_customer_phone']) ? $data['order_customer_phone'] : "empty",
409
+ 'billing_country_id' => ($data['order_country_iso']) ? $data['order_country_iso'] : "empty",
410
+ 'billing_region_id' => ($data['order_region ']) ? substr($data['order_region '], 0,2) : "EM",
411
+ 'shipping_firstname' => ($data['shipping_name']) ? $data['shipping_name'] : "empty",
412
+ 'shipping_lastname' => ($data['shipping_lastname']) ? $data['shipping_lastname'] : "empty",
413
+ 'shipping_street' => ($data['shipping_address']) ? $data['shipping_address'] : "empty",
414
+ 'shipping_city' => ($data['shipping_city']) ? $data['shipping_city'] : "empty",
415
+ 'shipping_postcode' => ($data['shipping_postalCode']) ? $data['shipping_postalCode'] : "empty",
416
+ 'shipping_telephone' => ($data['shipping_phone']) ? $data['shipping_phone'] : "empty",
417
+ 'shipping_country_id' => ($data['shipping_country_iso']) ? $data['shipping_country_iso'] : "empty",
418
+ 'shipping_region_id' => ($data['shipping_region']) ? substr($data['shipping_region'], 0, 2) : "EM" // id from directory_country_region table
419
+ );
420
+
421
+ $shippingData = array(
422
+
423
+ );
424
+ // Get the id of the orders shipping address
425
+ $orderId = $order->getId();
426
+ $beezupMageOrder = new BeezupMageOrders($orderId);
427
+ $beezupMageOrder->setData($addressData);
428
+ $beezupMageOrder->updateAdresses();
429
+ }
430
+
431
+ public function updateAddresses($shippingData, $address) {
432
+ if($shippingData['firstname'] !==$address['firstname']) {
433
+ $address->setFirstname($shippingData['firstname']);
434
+ }
435
+ if($shippingData['lastname'] !==$address['lastname']) {
436
+ $address->setLastname($shippingData['lastname']);
437
+ }
438
+ if($shippingData['street'] !==$address['street']) {
439
+ $address->setStreet($shippingData['street']);
440
+ }
441
+ if($shippingData['city'] !==$address['city']) {
442
+ $address->setCity($shippingData['city']);
443
+ }
444
+ if($shippingData['postcode'] !==$address['postcode']) {
445
+ $address->setPostcode($shippingData['postcode']);
446
+ }
447
+ if($shippingData['telephone'] !==$address['telephone']) {
448
+ $address->setTelephone($shippingData['telephone']);
449
+ }
450
+ $address->save();
451
+
452
+
453
+ }
454
+
455
+
456
+ public function loadMageOrder() {
457
+ $Mageorder = Mage::getModel('sales/order')->loadByIncrementId($this->orderid);
458
+ if ($Mageorder->getId()) {
459
+ return $Mageorder;
460
+ } else {
461
+ //we get order from marketplace orderid
462
+ $orderInc = $this->checkMarketOrderExists($this->orderid);
463
+ if($orderInc) {
464
+ // if exists
465
+ $Mageorder = Mage::getModel('sales/order')->loadByIncrementId($orderInc);
466
+ if ($Mageorder->getId()) {
467
+ return $Mageorder;
468
+ }
469
+ }
470
+ }
471
+ return false;
472
+ }
473
+
474
+
475
+ private function debugLog($message) {
476
+
477
+ if($this->orderid !== "") {
478
+ $message = $this->orderid." | ".$message;
479
+ }
480
+ $this->log->LogInfo($message);
481
+
482
+ $this->log2->LogInfo($message);
483
+ }
484
+
485
+ public function prescanOrder(BeezupOMOrderResult $order) {
486
+ $retorno = array();
487
+ $orderItems = $order->getOrderItems();
488
+ foreach ($orderItems as $item)
489
+ {
490
+
491
+ if ($item->getOrderItemOrderItemType () !== 'Product')
492
+ {
493
+ // continue;
494
+ }
495
+ $beezup_store = $item->getOrderItemBeezUPStoreId(); //beezup storeid
496
+ $mage_storeid = $this->checkOrderStore($beezup_store); //magento storeid
497
+ $marketplace_orderid = $item->getOrderItemMarketPlaceProductId();
498
+ if(!$mage_storeid) {
499
+
500
+ if(strpos($marketplace_orderid,'INTERETBCA') !== false || strpos($marketplace_orderid,'interetbca') !== false) { }
501
+ else {
502
+ $this->log->LogError($this->orderid." | No mapping for store ".$beezup_store);
503
+ $this->log2->LogError($this->orderid." | No mapping for store ".$beezup_store);
504
+ return false;
505
+ }
506
+
507
+ }
508
+ // $retorno['store'] = 1;
509
+ $retorno['store'] = $mage_storeid;
510
+ $this->debugLog("Store Matching succesful, Beezup Store: ".$beezup_store." , Magento Store Id: ".$mage_storeid);
511
+ $product_ImportedMerchantId = $item->getOrderItemMerchantImportedProductId();
512
+ $product_MerchantId = $item->getOrderItemMerchantProductId();
513
+
514
+ $product_quantity = $item->getOrderItemQuantity();
515
+ $product_price = $item->getOrderItemItemPrice();
516
+ $product_title = $item->getOrderItemTitle();
517
+ $product_image = $item->getOrderItemImageUrl();
518
+ if(strpos($marketplace_orderid,'INTERETBCA') !== false || strpos($marketplace_orderid,'interetbca') !== false) {
519
+ $retorno['discounts']= $item->getOrderItemTotalPrice();
520
+ } else {
521
+ $product = $this->getMageProduct($product_ImportedMerchantId , $product_MerchantId , $beezup_store );
522
+ if($product) {
523
+ $mage_productId = $product->getId();
524
+ $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
525
+ ->loadByProduct($product)->getQty();
526
+
527
+ $retorno['products'][] = array("id" => $mage_productId, "qty" => $product_quantity, "price" => $product_price, "curr_stock" => $stocklevel);
528
+ //producto existe
529
+ } else {
530
+ //vendria if de si activada opcion de crear producto creamos
531
+ if(!$this->debug) {
532
+ return false;
533
+ }
534
+ $product_data = array(
535
+ "sku" => $product_ImportedMerchantId,
536
+ "sku2" => $product_MerchantId,
537
+ "qty" => $product_quantity,
538
+ "price" => $product_price,
539
+ "title" => $product_title,
540
+ "image" => $product_image,
541
+ "storeId" => $mage_storeid
542
+ );
543
+ $product = $this->createProduct($product_data);
544
+ if(!$product) {
545
+ return false;
546
+ }
547
+ $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
548
+ ->loadByProduct($product)->getQty();
549
+ $mage_productId = $product->getId();
550
+ $retorno['products'][] = array("id" => $mage_productId, "qty" => $product_quantity, "price" => $product_price, "curr_stock" => $stocklevel);
551
+ }
552
+ }
553
+ }
554
+
555
+ return $retorno;
556
+ }
557
+
558
+
559
+
560
+ public function matchProductAttributes($importedId, $storeId) {
561
+ $product = null;
562
+ $helper = Mage::helper('beezup');
563
+ $attributes = $helper->getConfig('beezup/marketplace/attributes');
564
+ $attributes = unserialize ($attributes);
565
+
566
+ foreach($attributes['attributes'][$storeId ] as $attribute) {
567
+ $att = explode("|", $attribute);
568
+ if($storeId == $att[1]) {
569
+
570
+ $product=Mage::getModel('catalog/product')->loadByAttribute($att[0],$importedId);
571
+ if($product) {
572
+ break;
573
+ }
574
+ }
575
+ }
576
+
577
+ return $product;
578
+ }
579
+
580
+
581
+
582
+ public function getMageProduct($importedId, $merchantId, $storeId){
583
+ try {
584
+ $product=Mage::getModel('catalog/product')->load($importedId);
585
+ if (!$product->getId() || $product->getId() !== $importedId ){
586
+ $product = $this->matchProductAttributes($importedId, $storeId);
587
+ if($product == null || !is_object($product)) {
588
+ $product=Mage::getModel('catalog/product')->load($merchantId);
589
+ if(!$product->getId() || $product->getId() !== $merchantId ) {
590
+ $product = $this->matchProductAttributes($merchantId, $storeId);
591
+
592
+ }
593
+ }
594
+ }
595
+
596
+ if(is_object($product)) {
597
+ if($product->getId()) {
598
+ $this->debugLog("Product Matching succesful, Beezup Imported Id: ".$importedId." , Magento Product Id: ".$product->getId());
599
+ return $product;
600
+ }}
601
+ $this->log->LogError($this->orderid. "| No Product Matching, Product ".$importedId." could not be found");
602
+ $this->log2->LogError($this->orderid. "| No Product Matching, Product ".$importedId." could not be found");
603
+ return false;
604
+ }catch(Exception $e){
605
+ $this->log->LogError($this->orderid. "| Product ".$importedId." could not be found, error: ".$e->getMessage());
606
+ $this->log2->LogError($this->orderid. "| Product ".$importedId." could not be found, error: ".$e->getMessage());
607
+ return false;
608
+ //error no se pudo crear la orden
609
+
610
+ }
611
+ }
612
+
613
+
614
+ public function checkOrderStore($storeId ) {
615
+ $helper = Mage::helper('beezup');
616
+ $stores = $helper->getConfig('beezup/marketplace/stores');
617
+ $stores = unserialize ($stores);
618
+ foreach($stores as $store) {
619
+ if(isset($store[$storeId]) && $store[$storeId] > 0) {
620
+ return $store[$storeId];
621
+ }
622
+ }
623
+ return false;
624
+ }
625
+
626
+
627
+
628
+ /**
629
+ * @return BeezupOMOrderService
630
+ */
631
+ public function getOrderService(){
632
+ if ($this->oOrderService === null){
633
+ $this->oOrderService = $this->createOrderService();
634
+ // enchufamos debug mode, esta activado? false true $this->oOrderService->setDebugMode(false);
635
+ }
636
+ return $this->oOrderService;
637
+ }
638
+
639
+ /**
640
+ * @return BeezupOMOrderService
641
+ */
642
+ protected function createOrderService(){
643
+
644
+ return new BeezupOMOrderService($this->createRepository() );
645
+ }
646
+
647
+ protected function createRepository() {
648
+ if ($this->repository == null) {
649
+ $this->repository = new BeezupRepository();
650
+ }
651
+ return $this->repository;
652
+
653
+ }
654
+
655
+
656
+ private function enableFlatRate($enable = true) {
657
+ $resource = Mage::getSingleton('core/resource');
658
+ $writeConnection = $resource->getConnection('core_write');
659
+ $table = $resource->getTableName('core/config_data');
660
+ if($enable) {
661
+ $query = "update {$table} set value = '1' where path = 'carriers/flatrate/active'";
662
+ } else {
663
+ $query = "update {$table} set value = '1' where path = 'carriers/flatrate/active'";
664
+ }
665
+ $writeConnection->query($query);
666
+ }
667
+
668
+ public function addOrder($data, $oLink, $stop = false) {
669
+
670
+
671
+ try {
672
+ $helper = Mage::helper('beezup');
673
+ $addStock = $helper->getConfig('beezup/marketplace/available_products');
674
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
675
+ $quote = Mage::getModel('sales/quote')
676
+ ->setStoreId($data['storeid']);
677
+ $quote->setCustomerEmail($data['order_customer_email']);
678
+
679
+
680
+ $currency = Mage::getModel('directory/currency')->load($data['order_currency']);
681
+ $quote->setForcedCurrency($currency);
682
+
683
+ $blnCreate = true;
684
+ $total_new_price = 0;
685
+ foreach($data['products'] as $prod) {
686
+ if($prod['qty']==0) {
687
+ $blnCreate = false;
688
+ break;
689
+ }
690
+ $prod_totality_price = $prod['price']*$prod['qty'];
691
+ $total_new_price = $total_new_price + $prod_totality_price;
692
+ $product = Mage::getModel('catalog/product')->load($prod['id']);
693
+ $buyInfo = array(
694
+ 'qty' => $prod['qty'],
695
+ );
696
+ $this->debugLog("Adding ".$prod['qty']." product/s with id ".$product->getId()." to order, with Beezup Price: ".$prod['price']);
697
+ //echo "Product ".$product->getId()."<br><br>";
698
+ //para no perder stock:
699
+ //Mage::getModel('cataloginventory/stock')->backItemQty($productId,$new_qty);
700
+
701
+
702
+ if($addStock == 1) {
703
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
704
+
705
+ if ($stock->getQty() < $prod['qty'] && $product->getStockItem()->getMaxSaleQty() >= $prod['qty']) {
706
+ $this->debugLog("Product ".$product->getId()." Stock = 0, Updating to ".$prod['qty']." to generate Order");
707
+ // Mage::getModel('cataloginventory/stock')->backItemQty($product->getId(),$prod['qty']);
708
+ //$this->_updateStocks(array("id_product" => $product->getId(), "qty" => $prod['qty']));
709
+ $product->setStockData(
710
+ array(
711
+ 'is_in_stock' => 1,
712
+ 'qty' => $prod['qty'],
713
+ 'manage_stock' => 1,
714
+ 'use_config_notify_stock_qty' => 1
715
+ )
716
+ );
717
+ $product->save();
718
+ $product = Mage::getModel('catalog/product')->load($product->getId());
719
+
720
+ }
721
+ }
722
+ //fin para no perder stock
723
+
724
+ /*
725
+ $tax_class = $product->getTaxClassId();
726
+ $product->setTaxClassId(0);
727
+ $product->getResource()->saveAttribute($product, 'tax_class_id'); */
728
+ $price = $prod['price'];
729
+
730
+ $quote_item = Mage::getModel('beezup/quote_item');
731
+ $quote_item
732
+ ->setProduct($product)
733
+ ->setPrice((float) $price )
734
+ ->setCustomPrice((float)$price )
735
+ ->setOriginalCustomPrice((float) $price )
736
+ ->setQuote($quote)
737
+ ->setQty((integer) $prod['qty'])
738
+ ->setBeezupPrice((float) $price );
739
+
740
+
741
+ $quote->addItem($quote_item);
742
+
743
+ //$quote->addProduct($product, new Varien_Object($buyInfo))->setOriginalCustomPrice($price)->setCustomPrice($price);
744
+
745
+ /*
746
+ $product->setTaxClassId($tax_class);
747
+
748
+ $product->getResource()->saveAttribute($product, 'tax_class_id');
749
+ */
750
+ }
751
+
752
+ if($blnCreate) {
753
+ $addressData = array(
754
+ 'firstname' => ($data['order_customer']) ? $data['order_customer'] : "empty",
755
+ 'lastname' => ($data['order_lastname']) ? $data['order_lastname'] : "empty",
756
+ 'street' => ($data['order_address']) ? $data['order_address'] : "empty",
757
+ 'city' => ($data['order_city']) ? $data['order_city'] : "empty",
758
+ 'postcode' => ($data['order_postalCode']) ? $data['order_postalCode'] : "empty",
759
+ 'telephone' => ($data['order_customer_phone']) ? $data['order_customer_phone'] : "empty",
760
+ 'country_id' => ($data['order_country_iso']) ? $data['order_country_iso'] : "empty",
761
+ 'region_id' => ($data['order_region ']) ? substr($data['order_region '], 0,2) : "EM"// id from directory_country_region table
762
+ );
763
+
764
+ $shippingData = array(
765
+ 'firstname' => ($data['shipping_name']) ? $data['shipping_name'] : "empty",
766
+ 'lastname' => ($data['shipping_lastname']) ? $data['shipping_lastname'] : "empty",
767
+ 'street' => ($data['shipping_address']) ? $data['shipping_address'] : "empty",
768
+ 'city' => ($data['shipping_city']) ? $data['shipping_city'] : "empty",
769
+ 'postcode' => ($data['shipping_postalCode']) ? $data['shipping_postalCode'] : "empty",
770
+ 'telephone' => ($data['shipping_phone']) ? $data['shipping_phone'] : "empty",
771
+ 'country_id' => ($data['shipping_country_iso']) ? $data['shipping_country_iso'] : "empty",
772
+ 'region_id' => ($data['shipping_region']) ? substr($data['shipping_region'], 0, 2) : "EM" // id from directory_country_region table
773
+ );
774
+
775
+
776
+ $payment_method = $helper->getConfig('beezup/marketplace/payment_method');
777
+ $billingAddress = $quote->getBillingAddress()->addData($addressData);
778
+ $shippingAddress = $quote->getShippingAddress()->addData($shippingData);
779
+ $shipping_cost = (float) $data['order_shippingPrice'];
780
+ if($data['order_shippingPrice'] == 0) {
781
+ $shipping_cost = 20000;
782
+ }
783
+ $total_new_price = $total_new_price + $data['order_shippingPrice'] ;
784
+ Mage::unregister('shipping_cost');
785
+ Mage::register('shipping_cost', $shipping_cost);
786
+ $this->debugLog("Adding Order Shipping Cost: ". $data['order_shippingPrice']);
787
+
788
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
789
+ ->setShippingMethod('flatrate_flatrate')
790
+ ->setPaymentMethod($payment_method);
791
+
792
+ //$shippingAddress->addTotal(array("code" => "specialfee", "title" => "Special Fee", "value" => 20));
793
+ $quote->getPayment()->importData(array('method' => $payment_method));
794
+
795
+ $quote->collectTotals()->save();
796
+
797
+ $service = Mage::getModel('sales/service_quote', $quote);
798
+ $service->submitAll();
799
+ $order = $service->getOrder();
800
+
801
+
802
+
803
+ $quoteId = $order->getQuoteId();
804
+ //$this->setStatus($data['order_status'], $order);
805
+
806
+ $orderid = $order->getId();
807
+
808
+ $resource = Mage::getSingleton('core/resource');
809
+ $writeConnection = $resource->getConnection('core_write');
810
+ $table = $resource->getTableName('sales/order_grid');
811
+ $this->debugLog("Adding Beezup Marketplace Information to Order");
812
+ $marketplace = $data['marketplace'];
813
+ $beezup_name = $data['order_customer'];
814
+ $market_order_id =$this->orderid;
815
+ $beezup_order_id = $oLink->getBeezupOrderUUID();
816
+ $beezup_status = $data['order_status'];
817
+ $beezup_last_modification_date = $oLink->getOrderLastModificationUtcDate();
818
+ $beezup_last_modification_date = $beezup_last_modification_date->date;
819
+ $beezup_marketplace_status = $oLink->getOrderStatusMarketPlaceStatus();
820
+ $beezup_purchase_date = $oLink->getOrderPurchaseUtcDate();
821
+ $beezup_purchase_date = $beezup_purchase_date->date;
822
+ $beezup_marketplace_last_modification_date = $oLink->getOrderMarketPlaceLastModificationUtcDate();
823
+ $beezup_marketplace_last_modification_date = $beezup_marketplace_last_modification_date->date;
824
+ /* $date = new DateTime($$beezup_marketplace_last_modification_date);
825
+ $beezup_marketplace_last_modification_date = $date->format('d-m-Y H:i:s'). "(UTC Time)";
826
+ */
827
+
828
+ $beezup_total_paid = $oLink->getOrderTotalPrice()." ".$data['order_currency'];
829
+ $beezup_account_id = $oLink->getAccountId();
830
+ $beezup_comission = $oLink->getOrderTotalCommission()." ".$data['order_currency'];
831
+ $tot_comm = $oLink->getOrderTotalCommission();
832
+ if(empty($tot_comm ) || $tot_comm == 0) {
833
+ $beezup_comission = 0;
834
+ }
835
+ $query = "UPDATE {$table} SET beezup_marketplace = '{$marketplace}', beezup_name = '{$beezup_account_id}', beezup_order = 1, beezup_market_order_id = '{$market_order_id}',
836
+ beezup_order_id = '{$beezup_order_id}', beezup_status = '{$beezup_status}', beezup_last_modification_date = '{$beezup_last_modification_date}',
837
+ beezup_marketplace_status = '{$beezup_marketplace_status}', beezup_purchase_date = '{$beezup_purchase_date}', beezup_marketplace_last_modification_date = '{$beezup_marketplace_last_modification_date}',
838
+ beezup_total_paid = '{$beezup_total_paid}', beezup_etag = '{$data['etag']}' , beezup_comission = '{$beezup_comission}'
839
+ WHERE entity_id = ". (int)$orderid;
840
+ $writeConnection->query($query);
841
+ $disc_price = 0;
842
+ if(!empty($data['discounts']) && $data['discounts'] >0) {
843
+
844
+
845
+ $disc_price = round($data['discounts'],2);
846
+ $total_new_price = $total_new_price+$disc_price;
847
+ $table_address = $resource->getTableName("sales/quote_address");
848
+
849
+ $query = "update {$table_address} set beezup_fee = '{$disc_price}' where quote_id = '{$quoteId}' and address_type = 'shipping'";
850
+ $writeConnection->query($query);
851
+ $this->debugLog("Adding CDISCOUNT products with total price: ".$disc_price);
852
+ }
853
+
854
+ //if order id exists and has been created
855
+ if ($orderid)
856
+ {
857
+ //we send order id to beezup
858
+ $this->debugLog("Sending Magento Order Id to Beezup, Magento Order Id: ".$orderid);
859
+ $oResult = new BeezupOMSetOrderIdValues ();
860
+ $oResult->setOrderMerchantOrderId ( $orderid )->setOrderMerchantECommerceSoftwareName ( 'Magento' )->setOrderMerchantECommerceSoftwareVersion ( Mage::getVersion() );
861
+ $sendRequest = $this->getOrderService()->getClientProxy()->setOrderMerchantIdByLink($oLink->getLinkByRel('setMerchantOrderId'), $oResult);
862
+ }
863
+
864
+ $grand_total = $order->getGrandTotal();
865
+ $beezup_price = $oLink->getOrderTotalPrice() - $disc_price;
866
+ if($grand_total != (float) $beezup_price && $beezup_price > 0) {
867
+ $order->setGrandTotal((float) $beezup_price);
868
+ $order->setBaseGrandTotal((float) $beezup_price);
869
+ $diff = (((float) $beezup_price) - $grand_total);
870
+
871
+ $order->setTaxAmount($order->getTaxAmount() + $diff);
872
+ $order->save();
873
+ }elseif($grand_total != (float)$beezup_price && $beezup_price < 1) {
874
+
875
+ $order->setGrandTotal((float) $total_new_price);
876
+ $order->setBaseGrandTotal((float) $total_new_price);
877
+ $diff = (((float) $total_new_price) - $grand_total);
878
+
879
+ $order->setTaxAmount($order->getTaxAmount() + $diff);
880
+ $order->save();
881
+ }
882
+
883
+ $products = Mage::getResourceModel('sales/order_item_collection')
884
+ ->setOrderFilter($orderid);
885
+ foreach($products as $product) {
886
+ $product->setBaseOriginalPrice($product->getOriginalPrice());
887
+ $product->setBaseTaxAmount($product->getTaxAmount());
888
+ $product->setBaseTaxInvoiced($product->getTaxAmount());
889
+ $product->setBasePriceInclTax($product->getPriceInclTax());
890
+ $product->setBaseRowTotalInclTax($product->getRowTotalInclTax());
891
+ $product->save();
892
+ }
893
+ $order->setBaseTaxAmount($order->getTaxAmount());
894
+ $order->setBaseTaxInvoiced($order->getTaxAmount());
895
+ $order->setBaseTotalInvoiced($order->getTotalPaid());
896
+ $order->setBaseTotalPaid($order->getTotalPaid());
897
+ $order->setBaseGrandTotal($order->getTotalPaid());
898
+ $order->setBaseSubtotalInclTax($order->getSubtotalInclTax());
899
+ $order->save();
900
+
901
+ $this->setStatus($data['order_status'], $order);
902
+
903
+ $this->debugLog("Order imported succesfully, Magento Order Id: ".$orderid);
904
+ } else {
905
+ //product stock = 0 we dont create order
906
+ $this->log->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: Stock from Beezup product = 0 ");
907
+ $this->log2->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: Stock from Beezup product = 0 ");
908
+ }
909
+ }catch(Exception $e){
910
+
911
+
912
+ if($stop) {
913
+ $this->log->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: ".$e->getMessage());
914
+ $this->log2->LogError($this->orderid. "| Order ".$data['market_place_order_id']." could not be imported, error: ".$e->getMessage());
915
+ $this->restoreStock($data);
916
+ } else {
917
+ $this->debugLog("Order Import failed, Trying to import Order Again");
918
+ $this->addOrder($data, $oLink, true);
919
+
920
+ }
921
+ //error no se pudo crear la orden
922
+
923
+ }
924
+
925
+
926
+
927
+ }
928
+
929
+
930
+
931
+ public function restoreStock($data) {
932
+
933
+ try {
934
+ foreach($data['products'] as $prod) {
935
+ $product = Mage::getModel('catalog/product')->load($prod['id']);
936
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
937
+ if ($stock->getQty() != $prod['curr_stock'] ) {
938
+ $this->debugLog("Restoring Stock from Product ".$product->getId()." to: ".$prod['curr_stock'] ." due to Order Fail");
939
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
940
+ $stockItem->setData('is_in_stock', 0);
941
+ $stockItem->setData('qty', $prod['curr_stock']);
942
+ $stockItem->save();
943
+ $product->save();
944
+ }
945
+
946
+ }
947
+ } catch(Exception $e){
948
+ $this->log->LogError($this->orderid. "| Failed Restoring Product Stock: ".$e->getMessage());
949
+ $this->log2->LogError($this->orderid. "| Failed Restoring Product Stock: ".$e->getMessage());
950
+ }
951
+
952
+ }
953
+
954
+
955
+
956
+ private function createProduct($data) {
957
+
958
+ $sku = $data['sku'];
959
+ if(empty($data['sku'])) {
960
+ $sku = $data['sku2'];
961
+ }
962
+
963
+ Mage::app()->setCurrentStore($data['storeId']);
964
+ $product = Mage::getModel('catalog/product');
965
+ // if(!$product->getIdBySku('testsku61')):
966
+
967
+ try{
968
+ $product
969
+ // ->setStoreId(1) //you can set data in store scope
970
+ ->setWebsiteIds(array($data['storeId'])) //website ID the product is assigned to, as an array
971
+ ->setAttributeSetId($product->getDefaultAttributeSetId()) //ID of a attribute set named 'default'
972
+ ->setTypeId('simple') //product type
973
+ ->setCreatedAt(strtotime('now')) //product creation time
974
+ ->setSku($sku ) //SKU
975
+ ->setWeight(0)
976
+ ->setName($data['title']) //product name
977
+ ->setStatus(1) //product status (1 - enabled, 2 - disabled)
978
+ ->setTaxClassId(4) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)
979
+ ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE ) //catalog and search visibility
980
+ ->setPrice($data['price']) //price in form 11.22
981
+ ->setMsrpEnabled(1) //enable MAP
982
+ ->setMsrpDisplayActualPriceType(1) //display actual price (1 - on gesture, 2 - in cart, 3 - before order confirmation, 4 - use config)
983
+ ->setMsrp(0) //Manufacturer's Suggested Retail Price
984
+ ->setMetaTitle('')
985
+ ->setMetaKeyword('')
986
+ ->setMetaDescription('')
987
+ ->setDescription($data['title'])
988
+ ->setShortDescription($data['title'])
989
+ // ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization
990
+ //->addImageToMediaGallery('media/catalog/product/1/0/10243-1.png', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery
991
+ ->setStockData(array(
992
+ 'use_config_manage_stock' => 0, //'Use config settings' checkbox
993
+ 'manage_stock'=>1, //manage stock
994
+ 'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart
995
+ 'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart
996
+ 'is_in_stock' => 1, //Stock Availability
997
+ 'qty' => 1 //qty
998
+ )
999
+ );
1000
+ $product->save();
1001
+ return $product;
1002
+
1003
+ }catch(Exception $e){
1004
+ //log exception
1005
+ $this->log->LogError($this->orderid."| Product ".$sku." could not be created, error: ".$e->getMessage());
1006
+ $this->log2->LogError($this->orderid."| Product ".$sku." could not be created, error: ".$e->getMessage());
1007
+ return false;
1008
+ }
1009
+ }
1010
+
1011
+
1012
+
1013
+ public function setStatus($status, $order) {
1014
+ $helper = Mage::helper('beezup');
1015
+ $retorno = "";
1016
+ $blnCancel = false;
1017
+ $blnHold = false;
1018
+ switch($status) {
1019
+ case "New" :
1020
+ $this->debugLog("Setting Order Status to New");
1021
+ $retorno = $helper->getConfig('beezup/marketplace/status_new');
1022
+ break;
1023
+ case "InProgress" :
1024
+ $this->debugLog("Setting Order Status to InProgress");
1025
+ $retorno = $helper->getConfig('beezup/marketplace/status_progress');
1026
+ $this->payOrder($order);
1027
+ break;
1028
+ case "Aborted" :
1029
+ $this->debugLog("Setting Order Status to Aborted");
1030
+ $retorno = $helper->getConfig('beezup/marketplace/status_aborted');
1031
+ $blnHold = true;
1032
+
1033
+
1034
+ break;
1035
+ case "Closed" :
1036
+ $this->debugLog("Setting Order Status to Closed");
1037
+ $blnCancel =true;
1038
+ $retorno = $helper->getConfig('beezup/marketplace/status_closed');
1039
+ $this->payOrder($order);
1040
+ break;
1041
+ case "Canceled" :
1042
+ $this->debugLog("Setting Order Status to Cancelled");
1043
+ $retorno = $helper->getConfig('beezup/marketplace/status_cancelled');
1044
+
1045
+ break;
1046
+ case "Shipped" :
1047
+ $this->debugLog("Setting Order Status to Shipped");
1048
+ $retorno = $helper->getConfig('beezup/marketplace/status_shipped');
1049
+ $this->payOrder($order);
1050
+ break;
1051
+
1052
+ }
1053
+ $order->setData('state',$retorno);
1054
+ $order->setStatus($retorno);
1055
+ $history = $order->addStatusHistoryComment('Order was set to '.$retorno.' by Beezup.', false);
1056
+ $history->setIsCustomerNotified(false);
1057
+ $order->save();
1058
+ if($blnCancel) {
1059
+ $order->cancel()->save();
1060
+ }
1061
+ if($blnHold) {
1062
+ $order->hold()->save();
1063
+ }
1064
+
1065
+ return $retorno;
1066
+
1067
+ }
1068
+
1069
+
1070
+ public function getStatus($status1) {
1071
+ $helper = Mage::helper('beezup');
1072
+ $retorno = "";
1073
+ $status = strtolower($status1);
1074
+
1075
+ if($status == strtolower($helper->getConfig('beezup/marketplace/status_new') )) {
1076
+ $retorno = "New";
1077
+
1078
+ } elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_progress') ) ){
1079
+ $retorno = "InProgress";
1080
+
1081
+
1082
+ }
1083
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_aborted') )) {
1084
+
1085
+ $retorno = "Aborted" ;
1086
+ }
1087
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_closed') )) {
1088
+ $retorno = "Closed";
1089
+
1090
+ }
1091
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_cancelled')) ) {
1092
+
1093
+ $retorno = "Canceled";
1094
+ }
1095
+ elseif($status == strtolower($helper->getConfig('beezup/marketplace/status_shipped') )) {
1096
+
1097
+ $retorno = "Shipped";
1098
+ }
1099
+
1100
+
1101
+ return $retorno;
1102
+
1103
+ }
1104
+
1105
+
1106
+ public function checkMarketOrderExists($orderid) {
1107
+ $resource = Mage::getSingleton('core/resource');
1108
+ $readConnection = $resource->getConnection('core_read');
1109
+ $table = $resource->getTableName('sales/order_grid');
1110
+ $query = 'SELECT increment_id FROM ' . $table . ' WHERE beezup_order = 1 and beezup_market_order_id = \''
1111
+ . $orderid . '\' LIMIT 1';
1112
+ $order = $readConnection->fetchOne($query);
1113
+ if($order && !empty($order) && $this->orderId !== "") {
1114
+ return $order;
1115
+ }
1116
+ return false;
1117
+
1118
+ }
1119
+
1120
+ public function payOrder($order) {
1121
+ try {
1122
+ $this->debugLog("Generating Order Payment Invoice");
1123
+ if($order->canInvoice()) {
1124
+ $invoice = $order->prepareInvoice()
1125
+ ->setTransactionId($order->getId())
1126
+ ->addComment("Invoice created from Beezup.")
1127
+ ->register()
1128
+ ->pay();
1129
+ $transaction_save = Mage::getModel('core/resource_transaction')
1130
+ ->addObject($invoice)
1131
+ ->addObject($invoice->getOrder());
1132
+ $transaction_save->save();
1133
+ $this->debugLog("Order Payment Invoice Generated Succesfully");
1134
+ }
1135
+ }
1136
+ catch(Exception $e){
1137
+ //log exception
1138
+ $this->log->LogError($this->orderid."| Order Payment Invoice could not be generated, error: ".$e->getMessage());
1139
+ $this->log2->LogError($this->orderid."| Order Payment Invoice could not be generated, error: ".$e->getMessage());
1140
+ }
1141
+ }
1142
+
1143
+ }
app/code/community/BeezUp/Block/Tracking.php CHANGED
@@ -1,97 +1,97 @@
1
- <?php
2
-
3
- class BeezUp_Block_Tracking extends Mage_Core_Block_Text
4
- {
5
-
6
- public function getStoreId()
7
- {
8
- return Mage::getStoreConfig('beezup/tracking/storeid');
9
- }
10
-
11
- public function getOrderTracker()
12
- {
13
- if (!$this->getOrder() || !$this->getStoreId()) return '';
14
-
15
- $order = $this->getOrder();
16
- $infos = $this->getProductsInformations($order);
17
-
18
- $marge = '';
19
- if (Mage::getStoreConfig('beezup/tracking/marge')) {
20
- $marge = '&ListProductMargin=' . $infos['margin'] . '';
21
- }
22
-
23
- //montant HT sans frais de port
24
- if(Mage::getStoreConfig('beezup/tracking/montant')=="HT"){
25
- $totalCost = number_format($order->getSubtotal(), 2, '.', '');
26
- }
27
- //montant HT avec frais de port
28
- else if(Mage::getStoreConfig('beezup/tracking/montant')=="HT_port"){
29
- $totalCost = number_format($order->getSubtotal()+$order->getShippingInclTax(), 2, '.', '');
30
- }
31
- //montant TTC sans frais de port
32
- else if(Mage::getStoreConfig('beezup/tracking/montant')=="TTC"){
33
- $totalCost = number_format($order->getBaseGrandTotal()-$order->getShippingInclTax(), 2, '.', '');
34
- }
35
- //montant TTC avec frais de port
36
- else if(Mage::getStoreConfig('beezup/tracking/montant')=="TTC_port"){
37
- $totalCost = number_format($order->getBaseGrandTotal(), 2, '.', '');
38
- }
39
-
40
- if(Mage::app()->getStore()->isCurrentlySecure()) {
41
- $script = '<img src="https://tracker.beezup.com/SO?StoreId='. trim($this->getStoreId()) .
42
- '&OrderMerchantId=' . $order->getIncrementId() .
43
- '&TotalCost=' . $totalCost .
44
- '&ValidPayement=true'.
45
- '&ListProductId='. $infos['id'] .
46
- '&ListProductQuantity='. $infos['qty'] .
47
- '&ListProductUnitPrice=' . $infos['price'] .
48
- $marge .
49
- '" />' .
50
- PHP_EOL;
51
- }
52
- else {
53
- $script = '<img src="http://tracker.beezup.com/SO?StoreId='. trim($this->getStoreId()) .
54
- '&OrderMerchantId=' . $order->getIncrementId() .
55
- '&TotalCost=' . $totalCost .
56
- '&ValidPayement=true'.
57
- '&ListProductId='. $infos['id'] .
58
- '&ListProductQuantity='. $infos['qty'] .
59
- '&ListProductUnitPrice=' . $infos['price'] .
60
- $marge .
61
- '" />' .
62
- PHP_EOL;
63
- }
64
-
65
- if (Mage::getStoreConfigFlag('beezup/tracking/debug')) Mage::log($script, 7, 'beezup.log');
66
-
67
- return $script;
68
- }
69
-
70
- public function getProductsInformations($order)
71
- {
72
- $id = '';
73
- $qty = '';
74
- $price = '';
75
- $margin = '';
76
- $items = $order->getAllItems();
77
-
78
- foreach ($items as $itemId => $item) {
79
- if(number_format($item->getBasePrice(), 2, '.', '')!=0.00){
80
- $product = Mage::getModel('catalog/product')->load($item->getProductId());
81
- $id .= $item->getProductId() . '|';
82
- $qty .= intval($item->getQtyOrdered()) . '|';
83
- $price .= number_format($item->getBasePrice(), 2, '.', '') . '|';
84
- $margin .= number_format($item->getBasePrice() - $product->getCost(), 2, '.', '') . '|';
85
- }
86
- }
87
- return array('id' => substr($id, 0, -1), 'qty' => substr($qty, 0, -1), 'price' => substr($price, 0, -1), 'margin' => substr($margin, 0, -1));
88
- }
89
-
90
- protected function _toHtml()
91
- {
92
- $this->setCacheLifetime(null);
93
- $this->addText($this->getOrderTracker());
94
- return parent::_toHtml();
95
- }
96
-
97
  }
1
+ <?php
2
+
3
+ class BeezUp_Block_Tracking extends Mage_Core_Block_Text
4
+ {
5
+
6
+ public function getStoreId()
7
+ {
8
+ return Mage::getStoreConfig('beezup/tracking/storeid');
9
+ }
10
+
11
+ public function getOrderTracker()
12
+ {
13
+ if (!$this->getOrder() || !$this->getStoreId()) return '';
14
+
15
+ $order = $this->getOrder();
16
+ $infos = $this->getProductsInformations($order);
17
+
18
+ $marge = '';
19
+ if (Mage::getStoreConfig('beezup/tracking/marge')) {
20
+ $marge = '&ListProductMargin=' . $infos['margin'] . '';
21
+ }
22
+
23
+ //montant HT sans frais de port
24
+ if(Mage::getStoreConfig('beezup/tracking/montant')=="HT"){
25
+ $totalCost = number_format($order->getSubtotal(), 2, '.', '');
26
+ }
27
+ //montant HT avec frais de port
28
+ else if(Mage::getStoreConfig('beezup/tracking/montant')=="HT_port"){
29
+ $totalCost = number_format($order->getSubtotal()+$order->getShippingInclTax(), 2, '.', '');
30
+ }
31
+ //montant TTC sans frais de port
32
+ else if(Mage::getStoreConfig('beezup/tracking/montant')=="TTC"){
33
+ $totalCost = number_format($order->getBaseGrandTotal()-$order->getShippingInclTax(), 2, '.', '');
34
+ }
35
+ //montant TTC avec frais de port
36
+ else if(Mage::getStoreConfig('beezup/tracking/montant')=="TTC_port"){
37
+ $totalCost = number_format($order->getBaseGrandTotal(), 2, '.', '');
38
+ }
39
+
40
+ if(Mage::app()->getStore()->isCurrentlySecure()) {
41
+ $script = '<img src="https://tracker.beezup.com/SO?StoreId='. trim($this->getStoreId()) .
42
+ '&OrderMerchantId=' . $order->getIncrementId() .
43
+ '&TotalCost=' . $totalCost .
44
+ '&ValidPayement=true'.
45
+ '&ListProductId='. $infos['id'] .
46
+ '&ListProductQuantity='. $infos['qty'] .
47
+ '&ListProductUnitPrice=' . $infos['price'] .
48
+ $marge .
49
+ '" />' .
50
+ PHP_EOL;
51
+ }
52
+ else {
53
+ $script = '<img src="http://tracker.beezup.com/SO?StoreId='. trim($this->getStoreId()) .
54
+ '&OrderMerchantId=' . $order->getIncrementId() .
55
+ '&TotalCost=' . $totalCost .
56
+ '&ValidPayement=true'.
57
+ '&ListProductId='. $infos['id'] .
58
+ '&ListProductQuantity='. $infos['qty'] .
59
+ '&ListProductUnitPrice=' . $infos['price'] .
60
+ $marge .
61
+ '" />' .
62
+ PHP_EOL;
63
+ }
64
+
65
+ if (Mage::getStoreConfigFlag('beezup/tracking/debug')) Mage::log($script, 7, 'beezup.log');
66
+
67
+ return $script;
68
+ }
69
+
70
+ public function getProductsInformations($order)
71
+ {
72
+ $id = '';
73
+ $qty = '';
74
+ $price = '';
75
+ $margin = '';
76
+ $items = $order->getAllItems();
77
+
78
+ foreach ($items as $itemId => $item) {
79
+ if(number_format($item->getBasePrice(), 2, '.', '')!=0.00){
80
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
81
+ $id .= $item->getProductId() . '|';
82
+ $qty .= intval($item->getQtyOrdered()) . '|';
83
+ $price .= number_format($item->getBasePrice(), 2, '.', '') . '|';
84
+ $margin .= number_format($item->getBasePrice() - $product->getCost(), 2, '.', '') . '|';
85
+ }
86
+ }
87
+ return array('id' => substr($id, 0, -1), 'qty' => substr($qty, 0, -1), 'price' => substr($price, 0, -1), 'margin' => substr($margin, 0, -1));
88
+ }
89
+
90
+ protected function _toHtml()
91
+ {
92
+ $this->setCacheLifetime(null);
93
+ $this->addText($this->getOrderTracker());
94
+ return parent::_toHtml();
95
+ }
96
+
97
  }
app/code/community/BeezUp/Block/Xml.php CHANGED
@@ -1,727 +1,745 @@
1
- <?php
2
- ini_set('memory_limit','1024M');
3
- class BeezUp_Block_Xml extends Mage_Core_Block_Text
4
- {
5
- /**
6
- Xml permet de r�cup�rer tous les produits simples
7
- **/
8
- public function getXml()
9
- {
10
- $base_url = Mage::getBaseUrl();
11
- /* Load Model and Helper */
12
- $beezup = Mage::getModel('beezup/products');
13
- $helper = Mage::helper('beezup');
14
-
15
- /* Initially load the useful elements */
16
- $many_images = $helper->getConfig('beezup/flux/images');
17
- $_ht = $helper->getConfig('beezup/flux/ht');
18
- $_description = $helper->getConfig('beezup/flux/description');
19
- $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
20
- $_categories = $beezup->getCategoriesAsArray(Mage::helper('catalog/category')->getStoreCategories());
21
- $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
22
- $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
23
- $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
24
-
25
- /* Build file */
26
- $xml = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
27
- $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
28
-
29
- $products = $beezup->getProducts();
30
- if($many_images == 1) {
31
- $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
32
- }
33
- foreach ($products as $p) {
34
- $categories = $beezup->getProductsCategories($p, $_categories);
35
-
36
- if (count($categories)) {
37
- $qty = $beezup->getQty($p->getId());
38
- $stock = $beezup->getIsInStock($qty);
39
- $shipping = $beezup->getDelivery($qty);
40
- $price = $p->getPrice();
41
- $final_price = $p->getFinalPrice();
42
- if (($image = $p->getImage()) == "no_selection" || ($image = $p->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
43
- $image = $p->getSmallImage();
44
-
45
-
46
-
47
-
48
- $xml .= '<product>';
49
- $xml .= $helper->tag($this->__('b_unique_id'), $p->getId());
50
- $xml .= $helper->tag($this->__('b_sku'), trim($p->getSku()), 1);
51
- $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
52
- $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
53
- $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
54
-
55
-
56
-
57
- $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
58
- if($many_images == 1) {
59
- $inc = 1;
60
- //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
61
- //$product = Mage::getModel('catalog/product')->load( $p->getId());
62
- $backendModel->afterLoad($p); //adding media gallery to the product object
63
- $datos = $p->getData();
64
- foreach ($datos['media_gallery']['images'] as $img) {
65
-
66
- if($img['disabled']==0 && $image !== $img['file']) {
67
- $inc++;
68
- $xml .= $helper->tag($this->__('url_image')."_".$inc, $helper->getImageDir() .$img['file'], 1);
69
-
70
- }
71
- }
72
-
73
- }
74
-
75
- /*
76
- //we get all category id's from product
77
- $currentCatIds = $product->getCategoryIds();
78
- //we get a collection of the categories from the ids
79
- $categoryCollection = Mage::getResourceModel('catalog/category_collection')
80
- ->addAttributeToSelect('name')
81
- ->addAttributeToSelect('url')
82
- ->addAttributeToFilter('entity_id', $currentCatIds)
83
- ->addIsActiveFilter();
84
- $inc_cat = 0;
85
- //loop through category collection to add to xml categories
86
- foreach($categoryCollection as $cat){
87
- $inc_cat++;
88
- $xml .= $helper->tag($this->__('b_product_category_'.$inc_cat), $cat->getUrl(), 1);
89
- } */
90
-
91
-
92
- // $xml .= $helper->tag($this->__('b_product_image'), $helper->getImageDir() . $image, 1);
93
- $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
94
- $xml .= $helper->tag($this->__('b_qty'), $qty);
95
- $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
96
- $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($p->getWeight(), $_tablerates)));
97
- $xml .= $helper->tag($this->__('b_weight'), $helper->currency($p->getWeight()));
98
- $xml .= $helper->tag($this->__('b_price'), $helper->currency($final_price*$_vat));
99
- if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
100
- $i = 1;
101
- foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
102
- foreach ($_attributes as $a) {
103
- $value = $p->getResource()->getAttribute($a)->getFrontend()->getValue($p);
104
- $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
105
- }
106
-
107
- $xml .= '</product>' . PHP_EOL;
108
- }
109
- }
110
- $xml .= $this->getAssociatedProducto(false);
111
-
112
-
113
- $xml .= '</catalog>';
114
-
115
- return $xml;
116
- }
117
-
118
- /**
119
- Configurable permet de r�cup�rer tous les produits (p�re, enfant et simple)
120
- **/
121
- public function getXmlConfigurable()
122
- {
123
- $base_url = Mage::getBaseUrl();
124
- /* Load Model and Helper */
125
- $beezup = Mage::getModel('beezup/products');
126
- $helper = Mage::helper('beezup');
127
-
128
- /* Initially load the useful elements */
129
- $many_images = $helper->getConfig('beezup/flux/images');
130
- $_ht = $helper->getConfig('beezup/flux/ht');
131
- $_description = $helper->getConfig('beezup/flux/description');
132
- $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
133
- $_categories = $beezup->getCategoriesAsArray(Mage::helper('catalog/category')->getStoreCategories());
134
- $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
135
- $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
136
- $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
137
-
138
- /* Build file */
139
- $xml = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
140
- $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
141
-
142
- //r�cup�re tous les produits
143
- $products = $beezup->getProducts();
144
- $childs = $beezup->getConfigurableProducts(true);
145
- $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
146
- $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
147
- //parcours les produits
148
- foreach ($products as $p) {
149
- if($many_images == 1) {
150
- $backendModel->afterLoad($p); //adding media gallery to the product object
151
- $datos = $p->getData();
152
-
153
- }
154
-
155
- $categories = $beezup->getProductsCategories($p, $_categories);
156
- $varationTheme = $beezup->getOptions($p);
157
- //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
158
-
159
- if (count($categories)) {
160
- //si l'�l�ment est un p�re, on va traiter ces enfants
161
- if(isset($childs[$p->getId()])) {
162
- $childrens = $childs[$p->getId()];
163
-
164
- foreach($childrens as $c) {
165
- $qty = $beezup->getQty($c->getId());
166
- $stock = $beezup->getIsInStock($qty);
167
- $shipping = $beezup->getDelivery($qty);
168
- $price = $c->getPrice();
169
- $final_price = $c->getFinalPrice();
170
- $image = $this->fillImageUrl($p, $c);
171
-
172
- //DBG
173
- if (0)
174
- {
175
- echo "----------------------------" ."<br/>";
176
- echo "Name : " .$c->getName() ."<br/>";
177
- echo "Id : " .$c->getId() ."<br/>";
178
- echo "Parent Id : " .$p->getId() ."<br/>";
179
- echo "Url : " .$p->getProductUrl() ."<br/>";
180
- echo "Image : " .$helper->getImageDir().$image ."<br/>";
181
-
182
-
183
- echo "SKU : " .$c->getSku() ."<br/>";
184
- echo "Quantity : " .$qty ."<br/>";
185
- echo "Stock : " .$stock ."<br/>";
186
- echo "Shipping : " .$shipping ."<br/>";
187
- echo "price : " .$price ."<br/>";
188
- echo "finalprice : ".$final_price ."<br/>";
189
- echo "specialprice : ".$c->getSpecialPrice() ."<br/>";
190
- }
191
-
192
-
193
- $xml .= '<product>';
194
- $xml .= $helper->tag($this->__('b_unique_id'), $c->getId());
195
- $xml .= $helper->tag($this->__('b_sku'), trim($c->getSku()), 1);
196
-
197
- $xml .= $helper->tag($this->__('parent_or_child'), 'child', 1);
198
- $xml .= $helper->tag($this->__('parent_id'), $p->getId());
199
- $xml .= $helper->tag($this->__('variation-theme'), $varationTheme, 1);
200
-
201
- $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
202
- $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
203
- $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
204
-
205
- $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
206
- if($many_images==1) {
207
-
208
- $product = Mage::getModel('catalog/product')->load( $c->getId());
209
- $inc = 1;
210
- foreach ($product->getMediaGalleryImages() as $img) {
211
- if( $helper->getImageDir() . $image !== $img->getUrl()) {
212
- $inc++;
213
- $xml .= $helper->tag($this->__('url_image')."_".$inc, $img->getUrl(), 1);
214
- }
215
-
216
- }
217
-
218
- if($inc==1 && ($c->getImage() == "no_selection" || $c->getImage()=="" || $c->getSmallImage() == "no_selection" || $c->getSmallImage() == "")) { //if there are no child pictures
219
-
220
- $product = Mage::getModel('catalog/product')->load( $p->getId());
221
- $inc = 1;
222
- foreach ($product->getMediaGalleryImages() as $img) {
223
- if( $helper->getImageDir() . $image !== $img->getUrl()) {
224
- $inc++;
225
- $xml .= $helper->tag($this->__('url_image')."_".$inc, $img->getUrl(), 1);
226
- }
227
- }
228
-
229
-
230
- }
231
- }
232
- $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
233
- $xml .= $helper->tag($this->__('b_qty'), $qty);
234
- $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
235
- $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($c->getWeight(), $_tablerates)));
236
- $xml .= $helper->tag($this->__('b_weight'), $helper->currency($c->getWeight()));
237
- $xml .= $helper->tag($this->__('b_price'), $helper->currency($final_price*$_vat));
238
- if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
239
- $i = 1;
240
- foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
241
- foreach ($_attributes as $a) {
242
- $value = $c->getResource()->getAttribute($a)->getFrontend()->getValue($c);
243
- $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
244
- }
245
- $xml .= '</product>' . PHP_EOL;
246
- }
247
-
248
- $qty = $beezup->getQty($p->getId());
249
- $stock = $beezup->getIsInStock($qty);
250
- $shipping = $beezup->getDelivery($qty);
251
- $price = $p->getPrice();
252
- $final_price = $p->getFinalPrice();
253
- if (($image = $p->getImage()) == "no_selection" || ($image = $p->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
254
- $image = $p->getSmallImage();
255
-
256
-
257
- // si c'est un �l�ment parent
258
- $xml .= '<product>';
259
- $xml .= $helper->tag($this->__('b_unique_id'), $p->getId());
260
- $xml .= $helper->tag($this->__('b_sku'), trim($p->getSku()), 1);
261
-
262
- $xml .= $helper->tag($this->__('parent_or_child'), 'parent', 1);
263
- $xml .= $helper->tag($this->__('parent_id'), '');
264
- $xml .= $helper->tag($this->__('variation-theme'), $varationTheme, 1);
265
-
266
- $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
267
- $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
268
- $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
269
- $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
270
- if($many_images == 1) {
271
- $inc = 1;
272
- //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
273
- //$product = Mage::getModel('catalog/product')->load( $p->getId());
274
-
275
- foreach ($datos['media_gallery']['images'] as $img) {
276
-
277
- if($img['disabled']==0 && $image !== $img['file']) {
278
- $inc++;
279
- $xml .= $helper->tag($this->__('url_image')."_".$inc, $helper->getImageDir() .$img['file'], 1);
280
-
281
- }
282
- }
283
-
284
- }
285
-
286
- $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
287
- $xml .= $helper->tag($this->__('b_qty'), $qty);
288
- $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
289
- $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($p->getWeight(), $_tablerates)));
290
- $xml .= $helper->tag($this->__('b_weight'), $helper->currency($p->getWeight()));
291
- $xml .= $helper->tag($this->__('b_price'), $helper->currency($final_price*$_vat));
292
- if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
293
- $i = 1;
294
- foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
295
- foreach ($_attributes as $a) {
296
- $value = $p->getResource()->getAttribute($a)->getFrontend()->getValue($p);
297
- $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
298
- }
299
-
300
- $xml .= '</product>' . PHP_EOL;
301
- }
302
- }
303
- }
304
-
305
- $product_simple = $beezup->getProductsSimple();
306
- $backendModelSimple = $product_simple->getResource()->getAttribute('media_gallery')->getBackend();
307
- foreach ($product_simple as $p) {
308
-
309
- $prodAttributeSet = Mage::getModel('eav/entity_attribute_set')->load($p->getAttributeSetId())->getAttributeSetName();
310
-
311
- $categories = $beezup->getProductsCategories($p, $_categories);
312
-
313
- if (count($categories)) {
314
- $qty = $beezup->getQty($p->getId());
315
- $stock = $beezup->getIsInStock($qty);
316
- $shipping = $beezup->getDelivery($qty);
317
- $price = $p->getPrice();
318
- $final_price = $p->getFinalPrice();
319
- if (($image = $p->getImage()) == "no_selection" || ($image = $p->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
320
- $image = $p->getSmallImage();
321
-
322
-
323
- $xml .= '<product>';
324
- $xml .= $helper->tag($this->__('b_unique_id'), $p->getId());
325
- $xml .= $helper->tag($this->__('b_sku'), trim($p->getSku()), 1);
326
-
327
- $xml .= $helper->tag($this->__('parent_or_child'), 'simple', 1);
328
- $xml .= $helper->tag($this->__('parent_id'), '');
329
- $xml .= $helper->tag($this->__('variation-theme'), '', 1);
330
-
331
- $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
332
- $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
333
- $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
334
- $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
335
- if($many_images == 1) {
336
- $inc = 1;
337
- //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
338
- //$product = Mage::getModel('catalog/product')->load( $p->getId());
339
- $backendModelSimple->afterLoad($p); //adding media gallery to the product object
340
- $datos = $p->getData();
341
- foreach ($datos['media_gallery']['images'] as $img) {
342
-
343
- if($img['disabled']==0 && $image !== $img['file']) {
344
- $inc++;
345
- $xml .= $helper->tag($this->__('url_image')."_".$inc, $helper->getImageDir() .$img['file'], 1);
346
-
347
- }
348
- }
349
-
350
- }
351
-
352
- $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
353
- $xml .= $helper->tag($this->__('b_qty'), $qty);
354
- $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
355
- $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($p->getWeight(), $_tablerates)));
356
- $xml .= $helper->tag($this->__('b_weight'), $helper->currency($p->getWeight()));
357
- $xml .= $helper->tag($this->__('b_price'), $helper->currency($final_price*$_vat));
358
- if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
359
- $i = 1;
360
- foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
361
- foreach ($_attributes as $a) {
362
- $value = $p->getResource()->getAttribute($a)->getFrontend()->getValue($p);
363
- $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
364
- }
365
-
366
- $xml .= '</product>' . PHP_EOL;
367
- }
368
- //}
369
- }
370
- $xml .= $this->getAssociatedProducto(true);
371
- $xml .= '</catalog>';
372
-
373
- return $xml;
374
- }
375
-
376
-
377
- /**
378
- Children permet de r�cup�rer tous les produits enfants
379
- **/
380
- public function getXmlChild()
381
- {
382
- /* Load Model and Helper */
383
- $beezup = Mage::getModel('beezup/products');
384
- $helper = Mage::helper('beezup');
385
-
386
- /* Initially load the useful elements */
387
- $many_images = $helper->getConfig('beezup/flux/images');
388
- $_ht = $helper->getConfig('beezup/flux/ht');
389
- $_description = $helper->getConfig('beezup/flux/description');
390
- $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
391
- $_categories = $beezup->getCategoriesAsArray(Mage::helper('catalog/category')->getStoreCategories());
392
- $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
393
- $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
394
- $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
395
-
396
- /* Build file */
397
- $xml = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
398
- $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
399
-
400
- $childs = $beezup->getConfigurableProducts(false);
401
-
402
- foreach ($childs as $c) {
403
-
404
- //r�cup�rer l'image sur le p�re
405
- $productParentIds=Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($c->getId());
406
- foreach($productParentIds as $productParentId){
407
- $productParent = Mage::getModel('catalog/product')->load($productParentId);
408
- $image=$productParent->getImage();
409
- $categories = $beezup->getProductsCategories($productParent, $_categories);
410
- $url = $productParent->getProductUrl();
411
- $name = $productParent->getName();
412
- $description = $productParent->getData($_description);
413
- }
414
-
415
- if(count($categories)){
416
- $qty = $beezup->getQty($c->getId());
417
- $stock = $beezup->getIsInStock($qty);
418
- $shipping = $beezup->getDelivery($qty);
419
- $price = $c->getPrice();
420
- $final_price = $c->getFinalPrice();
421
- $image = $this->fillImageUrl($productParent, $c);
422
-
423
- $xml .= '<product>';
424
- $xml .= $helper->tag($this->__('b_unique_id'), $c->getId());
425
- $xml .= $helper->tag($this->__('b_sku'), trim($c->getSku()), 1);
426
-
427
- $xml .= $helper->tag($this->__('parent_or_child'), 'child', 1);
428
- $xml .= $helper->tag($this->__('parent_id'), $c->getParentId());
429
-
430
- $xml .= $helper->tag($this->__('b_title'), trim($name), 1);
431
- $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($description)), 1);
432
- $xml .= $helper->tag($this->__('b_product_url'), $url, 1);
433
-
434
- /*$inc = 0;
435
- $product = Mage::getModel('catalog/product')->load( $c->getId());
436
-
437
- foreach ($product->getMediaGalleryImages() as $image) {
438
- $inc++;
439
- if($inc==1) {
440
- $xml .= $helper->tag($this->__('url_image'), $image->getUrl(), 1);
441
- } else {
442
- $xml .= $helper->tag($this->__('url_image')."_".$inc, $image->getUrl(), 1);
443
- }
444
- }*/
445
- $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1); //r�cup�re l'image sur le p�re
446
-
447
- if($many_images == 1) {
448
- $product = Mage::getModel('catalog/product')->load( $c->getId());
449
- $inc = 1;
450
- foreach ($product->getMediaGalleryImages() as $img) {
451
- if($helper->getImageDir() . $image!== $img->getUrl()) {
452
- $inc++;
453
- $xml .= $helper->tag($this->__('url_image')."_".$inc, $img->getUrl(), 1);
454
- }
455
- }
456
-
457
-
458
-
459
- }
460
-
461
- $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
462
- $xml .= $helper->tag($this->__('b_qty'), $qty);
463
- $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
464
- $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($c->getWeight(), $_tablerates)));
465
- $xml .= $helper->tag($this->__('b_weight'), $helper->currency($c->getWeight()));
466
- $xml .= $helper->tag($this->__('b_price'), $helper->currency($final_price*$_vat));
467
- if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
468
- $i = 1;
469
- foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
470
- foreach ($_attributes as $a) {
471
- $value = $c->getResource()->getAttribute($a)->getFrontend()->getValue($c);
472
- $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
473
- }
474
-
475
- $xml .= '</product>' . PHP_EOL;
476
- }
477
- }
478
-
479
- $xml .= '</catalog>';
480
-
481
- return $xml;
482
- }
483
-
484
- /**
485
- Produit groupes
486
- **/
487
-
488
- public function getAssociatedProducto($configurable)
489
- {
490
-
491
- /* Load Model and Helper */
492
- $beezup = Mage::getModel('beezup/products');
493
- $helper = Mage::helper('beezup');
494
-
495
- /* Initially load the useful elements */
496
- $many_images = $helper->getConfig('beezup/flux/images');
497
- $_ht = $helper->getConfig('beezup/flux/ht');
498
- $_description = $helper->getConfig('beezup/flux/description');
499
- $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
500
- $_categories = $beezup->getCategoriesAsArray(Mage::helper('catalog/category')->getStoreCategories());
501
- $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
502
- $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
503
- $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
504
-
505
- $products = $beezup->getGroupedProduct();
506
-
507
- $buf = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
508
- foreach ($products as $product) {
509
- $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
510
-
511
- $parentCategories = $beezup->getProductsCategories($product, $_categories);
512
- $parentDesc = $product->getData($_description);
513
- $parentId = $product->getId();
514
- $parentImage = $product->getImage();
515
- $parentUrl = $product->getProductUrl();
516
-
517
- foreach ($associatedProducts as $g) {
518
- $qty = $beezup->getQty($g->getId());
519
- $stock = $beezup->getIsInStock($qty);
520
- $shipping = $beezup->getDelivery($qty);
521
- $price = $g->getPrice();
522
- $final_price = $g->getFinalPrice();
523
-
524
- $image = $this->fillImageUrl($product, $g);
525
-
526
-
527
- //if (($image = $g->getImage()) == "no_selection" || ($image = $g->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
528
- // $image = $g->getSmallImage();
529
-
530
-
531
- //DBG
532
- if (0)
533
- {
534
- echo "----------------------------" ."<br/>";
535
- echo "Name : " .$g->getName() ."<br/>";
536
- echo "Description : ".$parentDesc ."<br/>";
537
- echo "Id : " .$g->getId() ."<br/>";
538
- echo "Parent Id : " .$parentId ."<br/>";
539
- echo "Url : " .$parentUrl ."<br/>";
540
- echo "Image : " .$helper->getImageDir().$image ."<br/>";
541
-
542
-
543
- echo "SKU : " .$g->getSku() ."<br/>";
544
- echo "Quantity : " .$qty ."<br/>";
545
- echo "Stock : " .$stock ."<br/>";
546
- echo "Shipping : " .$shipping ."<br/>";
547
- echo "price : " .$price ."<br/>";
548
- echo "finalprice : ".$final_price ."<br/>";
549
- echo "weight : " .$g->getWeight() ."<br/>";
550
-
551
- $i = 1;
552
- foreach ($parentCategories as $v)
553
- echo "Cat�gorie ".$i." : ".$v."<br/>";
554
- }
555
-
556
-
557
- $buf .= "<product>";
558
- $buf .= $helper->tag($this->__('b_unique_id'), $g->getId());
559
- $buf .= $helper->tag($this->__('b_sku'), trim($g->getSku()), 1);
560
- if ($configurable){
561
- $buf .= $helper->tag($this->__('parent_or_child'), 'grouped_child', 1);
562
- $buf .= $helper->tag($this->__('parent_id'), $parentId);
563
- }
564
- $buf .= $helper->tag($this->__('b_title'), $g->getName()/*trim($name)*/, 1);
565
- $buf .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($parentDesc)), 1);
566
- $buf .= $helper->tag($this->__('b_product_url'), $parentUrl, 1);
567
-
568
- /*
569
- if($many_images==1) {
570
-
571
- $gprod = Mage::getModel('catalog/product')->load( $g->getId());
572
- $inc = 0;
573
- foreach ($gprod->getMediaGalleryImages() as $image) {
574
- $inc++;
575
- if($inc==1) {
576
- $buf .= $helper->tag($this->__('url_image'), $image->getUrl(), 1);
577
- } else {
578
- $buf .= $helper->tag($this->__('url_image')."_".$inc, $image->getUrl(), 1);
579
- }
580
- }
581
- } else {
582
-
583
- $buf .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
584
- }*/
585
-
586
- $buf .= $helper->tag($this->__('b_product_image'), $helper->getImageDir() . $image, 1); //r�cup�re l'image sur le p�re
587
- $buf .= $helper->tag($this->__('b_availability'), $stock, 1);
588
- $buf .= $helper->tag($this->__('b_qty'), $qty);
589
- $buf .= $helper->tag($this->__('b_delivery'), $shipping, 1);
590
- $buf .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($g->getWeight(), $_tablerates)));
591
- $buf .= $helper->tag($this->__('b_weight'), $helper->currency($g->getWeight()));
592
- $buf .= $helper->tag($this->__('b_price'), $helper->currency($final_price * $_vat));
593
- if ($price != $final_price) $buf .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
594
- $i = 1;
595
- foreach ($parentCategories as $v) $buf .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
596
- foreach ($_attributes as $a) {
597
- $value = $g->getResource()->getAttribute($a)->getFrontend()->getValue($g);
598
- $buf .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
599
- }
600
- $buf .= "</product>".PHP_EOL;
601
- }
602
- }
603
- return $buf;
604
- }
605
-
606
-
607
- protected function fillImageUrl($p, $c)
608
- {
609
- $image = $c->getImage();
610
- if ($image == "no_selection" || $image == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
611
- {
612
- $image = $c->getSmallImage();
613
- if ($image == "no_selection" || $image == "")
614
- {
615
- $image = $p->getImage();
616
- if ($image == "no_selection" || $image == "")
617
- $image = $p->getSmallImage();
618
- }
619
- }
620
- return ($image);
621
- }
622
-
623
- protected function createFile($type, $xmlData)
624
- {
625
- $fp = fopen('beezup/tmp/'.$type, 'w');
626
- if ($fp == false)
627
- {
628
- echo 'Fail to create file';
629
- }
630
- fwrite($fp, $xmlData);
631
- fclose($fp);
632
- }
633
-
634
- protected function deleteFeed($type)
635
- {
636
- unlink('beezup/tmp/'.$type);
637
- }
638
-
639
- protected function needRefreshing($type)
640
- {
641
- $helper = Mage::helper('beezup');
642
-
643
- $delay = $helper->getConfig('beezup/flux/cachedelay') * 60;
644
- $nowtime = time();
645
- $fileTime = filemtime('beezup/tmp/'.$type);
646
- if (($nowtime - $fileTime) >= $delay)
647
- return (true);
648
- else
649
- return (false);
650
- }
651
-
652
- protected function createFolder()
653
- {
654
- $helper = Mage::helper('beezup');
655
- if (!$helper->getConfig('beezup/flux/cachedelay')) // Si option cache desactiv�e, pas besoin du dossier
656
- return (true);
657
- if (file_exists('beezup/tmp')) // Si le dossier existe deja, pas besoin de le recr�er
658
- return (true);
659
- if (!mkdir('beezup/tmp', 0777, true))
660
- {
661
- echo "[ERROR] : Seems we can't create 'beezup' directory inside your root directory."."<br/>"
662
- ."You can try one of these solutions :"."<br/>"
663
- ."1 - Create by yourself the beezup/tmp inside your root directory with 777 permissions"."<br/>"
664
- ."2 - Change the permissions on your root directory (777)"."<br/>"
665
- ."3 - Change the 'cache delay' option to 'None' inside beezup plugin settings"."<br/>";
666
- return (false);
667
- }
668
- return (true);
669
- }
670
-
671
-
672
-
673
- /**
674
- C'est ici que tout commence ...
675
- **/
676
-
677
- protected function _toHtml()
678
- {
679
- set_time_limit(0);
680
- $helper = Mage::helper('beezup');
681
- $this->setCacheLifetime(null);
682
- //dbg
683
- /*
684
- $this->getAssociatedProducto(true);
685
- return;*/
686
-
687
- if (!$this->createFolder()) // Si on rencontre des probl�mes de cr�ation de dossier on retourne rien
688
- return;
689
- if ($this->getConfigurable()){ // Appel de l'url http://site.com/beezup/catalog/configurable
690
- if ($this->needRefreshing('configurable')){
691
- if (file_exists('beezup/tmp/configurable'))
692
- $this->deleteFeed('configurable');
693
- $xmlData = $this->getXmlConfigurable();
694
- $this->addText($xmlData);
695
- if ($helper->getConfig('beezup/flux/cachedelay') != 0)
696
- $this->createFile('configurable', $xmlData);
697
- }
698
- else
699
- echo file_get_contents('beezup/tmp/configurable');
700
- }
701
- else if ($this->getChildXML()){ // Appel de l'url http://site.com/beezup/catalog/child
702
- if ($this->needRefreshing('child')){
703
- if (file_exists('beezup/tmp/child'))
704
- $this->deleteFeed('child');
705
- $xmlData = $this->getXmlChild();
706
- $this->addText($xmlData);
707
- if ($helper->getConfig('beezup/flux/cachedelay') != 0)
708
- $this->createFile('child', $xmlData);
709
- }
710
- else
711
- echo file_get_contents('beezup/tmp/child');
712
- }
713
- else { // Appel de l'url http://site.com/beezup/catalog/xml
714
- if ($this->needRefreshing('xml')){
715
- if (file_exists('beezup/tmp/xml'))
716
- $this->deleteFeed('xml');
717
- $xmlData = $this->getXml();
718
- $this->addText($xmlData);
719
- if ($helper->getConfig('beezup/flux/cachedelay') != 0)
720
- $this->createFile('xml', $xmlData);
721
- }
722
- else
723
- echo file_get_contents('beezup/tmp/xml');
724
- }
725
- return parent::_toHtml();
726
- }
727
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ini_set('memory_limit','1024M');
3
+ class BeezUp_Block_Xml extends Mage_Core_Block_Text
4
+ {
5
+ /**
6
+ Xml permet de r�cup�rer tous les produits simples
7
+ **/
8
+ public function getXml()
9
+ {
10
+
11
+
12
+ $base_url = Mage::getBaseUrl();
13
+ /* Load Model and Helper */
14
+ $beezup = Mage::getModel('beezup/products');
15
+ $helper = Mage::helper('beezup');
16
+
17
+ /* Initially load the useful elements */
18
+ $many_images = $helper->getConfig('beezup/flux/images');
19
+ $_ht = $helper->getConfig('beezup/flux/ht');
20
+ $_description = $helper->getConfig('beezup/flux/description');
21
+ $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
22
+ $categories = Mage::getModel('catalog/category')->getCollection()
23
+ ->addAttributeToSelect('*')//or you can just add some attributes
24
+ ->addAttributeToFilter('level', 2)
25
+ ->addAttributeToFilter('is_active', 1);
26
+ $_categories = $beezup->getCategoriesAsArray( $categories );
27
+ // $_categories = $beezup->getCategoriesAsArray(Mage::helper('catalog/category')->getStoreCategories());
28
+ $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
29
+ $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
30
+ $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
31
+
32
+ /* Build file */
33
+ $xml = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
34
+ $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
35
+
36
+ $products = $beezup->getProducts();
37
+ if($many_images == 1) {
38
+ $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
39
+ }
40
+ foreach ($products as $p) {
41
+ $categories = $beezup->getProductsCategories($p, $_categories);
42
+
43
+ if (count($categories)) {
44
+ $qty = $beezup->getQty($p->getId());
45
+ $stock = $beezup->getIsInStock($qty);
46
+ $shipping = $beezup->getDelivery($qty);
47
+ $price = $p->getPrice();
48
+ //$final_price = $p->getFinalPrice();
49
+ if (($image = $p->getImage()) == "no_selection" || ($image = $p->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
50
+ $image = $p->getSmallImage();
51
+
52
+
53
+
54
+
55
+ $xml .= '<product>';
56
+ $xml .= $helper->tag($this->__('b_unique_id'), $p->getId());
57
+ $xml .= $helper->tag($this->__('b_sku'), trim($p->getSku()), 1);
58
+ $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
59
+ $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
60
+ $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
61
+
62
+
63
+
64
+ $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
65
+ if($many_images == 1) {
66
+ $inc = 1;
67
+ //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
68
+ //$product = Mage::getModel('catalog/product')->load( $p->getId());
69
+ $backendModel->afterLoad($p); //adding media gallery to the product object
70
+ $datos = $p->getData();
71
+ foreach ($datos['media_gallery']['images'] as $img) {
72
+
73
+ if($img['disabled']==0 && $image !== $img['file']) {
74
+ $inc++;
75
+ $xml .= $helper->tag($this->__('url_image')."_".$inc, $helper->getImageDir() .$img['file'], 1);
76
+
77
+ }
78
+ }
79
+
80
+ }
81
+
82
+ /*
83
+ //we get all category id's from product
84
+ $currentCatIds = $product->getCategoryIds();
85
+ //we get a collection of the categories from the ids
86
+ $categoryCollection = Mage::getResourceModel('catalog/category_collection')
87
+ ->addAttributeToSelect('name')
88
+ ->addAttributeToSelect('url')
89
+ ->addAttributeToFilter('entity_id', $currentCatIds)
90
+ ->addIsActiveFilter();
91
+ $inc_cat = 0;
92
+ //loop through category collection to add to xml categories
93
+ foreach($categoryCollection as $cat){
94
+ $inc_cat++;
95
+ $xml .= $helper->tag($this->__('b_product_category_'.$inc_cat), $cat->getUrl(), 1);
96
+ } */
97
+
98
+
99
+ // $xml .= $helper->tag($this->__('b_product_image'), $helper->getImageDir() . $image, 1);
100
+ $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
101
+ $xml .= $helper->tag($this->__('b_qty'), $qty);
102
+ $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
103
+ $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($p->getWeight(), $_tablerates)));
104
+ $xml .= $helper->tag($this->__('b_weight'), $helper->currency($p->getWeight()));
105
+ $xml .= $helper->tag($this->__('b_price'), $helper->currency($final_price*$_vat));
106
+ // if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
107
+ $i = 1;
108
+ foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
109
+ foreach ($_attributes as $a) {
110
+ $value = $p->getResource()->getAttribute($a)->getFrontend()->getValue($p);
111
+ $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
112
+ }
113
+
114
+ $xml .= '</product>' . PHP_EOL;
115
+ }
116
+ }
117
+ $xml .= $this->getAssociatedProducto(false);
118
+
119
+
120
+ $xml .= '</catalog>';
121
+
122
+ return $xml;
123
+ }
124
+
125
+ /**
126
+ Configurable permet de r�cup�rer tous les produits (p�re, enfant et simple)
127
+ **/
128
+ public function getXmlConfigurable()
129
+ {
130
+ $base_url = Mage::getBaseUrl();
131
+ /* Load Model and Helper */
132
+ $beezup = Mage::getModel('beezup/products');
133
+ $helper = Mage::helper('beezup');
134
+
135
+ /* Initially load the useful elements */
136
+ $many_images = $helper->getConfig('beezup/flux/images');
137
+ $_ht = $helper->getConfig('beezup/flux/ht');
138
+ $_description = $helper->getConfig('beezup/flux/description');
139
+ $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
140
+ $categories = Mage::getModel('catalog/category')->getCollection()
141
+ ->addAttributeToSelect('*')//or you can just add some attributes
142
+ ->addAttributeToFilter('level', 2)
143
+ ->addAttributeToFilter('is_active', 1);
144
+ $_categories = $beezup->getCategoriesAsArray( $categories );
145
+ $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
146
+ $_attributes = array();
147
+ $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
148
+ $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
149
+
150
+ /* Build file */
151
+ $xml = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
152
+ $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
153
+
154
+ //r�cup�re tous les produits
155
+ $products = $beezup->getProducts();
156
+ $childs = $beezup->getConfigurableProducts(true);
157
+ $backendModel = $products->getResource()->getAttribute('media_gallery')->getBackend();
158
+ $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
159
+ //parcours les produits
160
+ foreach ($products as $p) {
161
+ if($many_images == 1) {
162
+ $backendModel->afterLoad($p); //adding media gallery to the product object
163
+ $datos = $p->getData();
164
+
165
+ }
166
+
167
+ $categories = $beezup->getProductsCategories($p, $_categories);
168
+ //$varationTheme = $beezup->getOptions($p);
169
+ //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
170
+
171
+ if (count($categories)) {
172
+ //si l'�l�ment est un p�re, on va traiter ces enfants
173
+ if(isset($childs[$p->getId()])) {
174
+ $childrens = $childs[$p->getId()];
175
+
176
+ foreach($childrens as $c) {
177
+ $qty = $beezup->getQty($c->getId());
178
+ $stock = $beezup->getIsInStock($qty);
179
+ $shipping = $beezup->getDelivery($qty);
180
+ $price = $c->getPrice();
181
+ // $final_price = $c->getFinalPrice();
182
+ $image = $this->fillImageUrl($p, $c);
183
+
184
+ //DBG
185
+ if (0)
186
+ {
187
+ echo "----------------------------" ."<br/>";
188
+ echo "Name : " .$c->getName() ."<br/>";
189
+ echo "Id : " .$c->getId() ."<br/>";
190
+ echo "Parent Id : " .$p->getId() ."<br/>";
191
+ echo "Url : " .$p->getProductUrl() ."<br/>";
192
+ echo "Image : " .$helper->getImageDir().$image ."<br/>";
193
+
194
+
195
+ echo "SKU : " .$c->getSku() ."<br/>";
196
+ echo "Quantity : " .$qty ."<br/>";
197
+ echo "Stock : " .$stock ."<br/>";
198
+ echo "Shipping : " .$shipping ."<br/>";
199
+ echo "price : " .$price ."<br/>";
200
+ echo "finalprice : ".$final_price ."<br/>";
201
+ echo "specialprice : ".$c->getSpecialPrice() ."<br/>";
202
+ }
203
+
204
+
205
+ $xml .= '<product>';
206
+ $xml .= $helper->tag($this->__('b_unique_id'), $c->getId());
207
+ $xml .= $helper->tag($this->__('b_sku'), trim($c->getSku()), 1);
208
+
209
+ $xml .= $helper->tag($this->__('parent_or_child'), 'child', 1);
210
+ $xml .= $helper->tag($this->__('parent_id'), $p->getId());
211
+ //$xml .= $helper->tag($this->__('variation-theme'), $varationTheme, 1);
212
+
213
+ $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
214
+ $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
215
+ $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
216
+
217
+ $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
218
+ if($many_images==1) {
219
+
220
+ $product = Mage::getModel('catalog/product')->load( $c->getId());
221
+ $inc = 1;
222
+ foreach ($product->getMediaGalleryImages() as $img) {
223
+ if( $helper->getImageDir() . $image !== $img->getUrl()) {
224
+ $inc++;
225
+ $xml .= $helper->tag($this->__('url_image')."_".$inc, $img->getUrl(), 1);
226
+ }
227
+
228
+ }
229
+
230
+ if($inc==1 && ($c->getImage() == "no_selection" || $c->getImage()=="" || $c->getSmallImage() == "no_selection" || $c->getSmallImage() == "")) { //if there are no child pictures
231
+
232
+ $product = Mage::getModel('catalog/product')->load( $p->getId());
233
+ $inc = 1;
234
+ foreach ($product->getMediaGalleryImages() as $img) {
235
+ if( $helper->getImageDir() . $image !== $img->getUrl()) {
236
+ $inc++;
237
+ $xml .= $helper->tag($this->__('url_image')."_".$inc, $img->getUrl(), 1);
238
+ }
239
+ }
240
+
241
+
242
+ }
243
+ }
244
+ $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
245
+ $xml .= $helper->tag($this->__('b_qty'), $qty);
246
+ $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
247
+ $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($c->getWeight(), $_tablerates)));
248
+ $xml .= $helper->tag($this->__('b_weight'), $helper->currency($c->getWeight()));
249
+ $xml .= $helper->tag($this->__('b_price'), $helper->currency($price*$_vat));
250
+ // if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
251
+ $i = 1;
252
+ foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
253
+ foreach ($_attributes as $a) {
254
+ $value = $c->getResource()->getAttribute($a)->getFrontend()->getValue($c);
255
+ $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
256
+ }
257
+ $xml .= '</product>' . PHP_EOL;
258
+ }
259
+
260
+ $qty = $beezup->getQty($p->getId());
261
+ $stock = $beezup->getIsInStock($qty);
262
+ $shipping = $beezup->getDelivery($qty);
263
+ $price = $p->getPrice();
264
+ //$final_price = $p->getFinalPrice();
265
+ if (($image = $p->getImage()) == "no_selection" || ($image = $p->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
266
+ $image = $p->getSmallImage();
267
+
268
+
269
+ // si c'est un �l�ment parent
270
+ $xml .= '<product>';
271
+ $xml .= $helper->tag($this->__('b_unique_id'), $p->getId());
272
+ $xml .= $helper->tag($this->__('b_sku'), trim($p->getSku()), 1);
273
+
274
+ $xml .= $helper->tag($this->__('parent_or_child'), 'parent', 1);
275
+ $xml .= $helper->tag($this->__('parent_id'), '');
276
+ // $xml .= $helper->tag($this->__('variation-theme'), $varationTheme, 1);
277
+
278
+ $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
279
+ $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
280
+ $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
281
+ $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
282
+ if($many_images == 1) {
283
+ $inc = 1;
284
+ //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
285
+ //$product = Mage::getModel('catalog/product')->load( $p->getId());
286
+
287
+ foreach ($datos['media_gallery']['images'] as $img) {
288
+
289
+ if($img['disabled']==0 && $image !== $img['file']) {
290
+ $inc++;
291
+ $xml .= $helper->tag($this->__('url_image')."_".$inc, $helper->getImageDir() .$img['file'], 1);
292
+
293
+ }
294
+ }
295
+
296
+ }
297
+
298
+ $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
299
+ $xml .= $helper->tag($this->__('b_qty'), $qty);
300
+ $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
301
+ $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($p->getWeight(), $_tablerates)));
302
+ $xml .= $helper->tag($this->__('b_weight'), $helper->currency($p->getWeight()));
303
+ $xml .= $helper->tag($this->__('b_price'), $helper->currency($price*$_vat));
304
+ // if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
305
+ $i = 1;
306
+ foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
307
+ foreach ($_attributes as $a) {
308
+ $value = $p->getResource()->getAttribute($a)->getFrontend()->getValue($p);
309
+ $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
310
+ }
311
+
312
+ $xml .= '</product>' . PHP_EOL;
313
+ }
314
+ }
315
+ }
316
+
317
+ $product_simple = $beezup->getProductsSimple();
318
+ if($many_images == 1) {
319
+ $backendModelSimple = $product_simple->getResource()->getAttribute('media_gallery')->getBackend();
320
+ }
321
+ foreach ($product_simple as $p) {
322
+
323
+ $prodAttributeSet = Mage::getModel('eav/entity_attribute_set')->load($p->getAttributeSetId())->getAttributeSetName();
324
+
325
+ $categories = $beezup->getProductsCategories($p, $_categories);
326
+
327
+ if (count($categories)) {
328
+ $qty = $beezup->getQty($p->getId());
329
+ $stock = $beezup->getIsInStock($qty);
330
+ $shipping = $beezup->getDelivery($qty);
331
+ $price = $p->getPrice();
332
+ // $final_price = $p->getFinalPrice();
333
+ if (($image = $p->getImage()) == "no_selection" || ($image = $p->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
334
+ $image = $p->getSmallImage();
335
+
336
+
337
+ $xml .= '<product>';
338
+ $xml .= $helper->tag($this->__('b_unique_id'), $p->getId());
339
+ $xml .= $helper->tag($this->__('b_sku'), trim($p->getSku()), 1);
340
+
341
+ $xml .= $helper->tag($this->__('parent_or_child'), 'simple', 1);
342
+ $xml .= $helper->tag($this->__('parent_id'), '');
343
+ $xml .= $helper->tag($this->__('variation-theme'), '', 1);
344
+
345
+ $xml .= $helper->tag($this->__('b_title'), trim($p->getName()), 1);
346
+ $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($p->getData($_description))), 1);
347
+ $xml .= $helper->tag($this->__('b_product_url'), $p->getProductUrl(), 1);
348
+ $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
349
+ if($many_images == 1) {
350
+ $inc = 1;
351
+ //we get product object from catalog/product reason(beezup/products gets products from catalog/product_collection, didn't find the way to get image collection from there *will check)
352
+ //$product = Mage::getModel('catalog/product')->load( $p->getId());
353
+ $backendModelSimple->afterLoad($p); //adding media gallery to the product object
354
+ $datos = $p->getData();
355
+ foreach ($datos['media_gallery']['images'] as $img) {
356
+
357
+ if($img['disabled']==0 && $image !== $img['file']) {
358
+ $inc++;
359
+ $xml .= $helper->tag($this->__('url_image')."_".$inc, $helper->getImageDir() .$img['file'], 1);
360
+
361
+ }
362
+ }
363
+
364
+ }
365
+
366
+ $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
367
+ $xml .= $helper->tag($this->__('b_qty'), $qty);
368
+ $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
369
+ $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($p->getWeight(), $_tablerates)));
370
+ $xml .= $helper->tag($this->__('b_weight'), $helper->currency($p->getWeight()));
371
+ $xml .= $helper->tag($this->__('b_price'), $helper->currency($price*$_vat));
372
+ // if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
373
+ $i = 1;
374
+ foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
375
+ foreach ($_attributes as $a) {
376
+ $value = $p->getResource()->getAttribute($a)->getFrontend()->getValue($p);
377
+ $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
378
+ }
379
+
380
+ $xml .= '</product>' . PHP_EOL;
381
+ }
382
+ //}
383
+ }
384
+ $xml .= $this->getAssociatedProducto(true);
385
+ $xml .= '</catalog>';
386
+
387
+ return $xml;
388
+ }
389
+
390
+
391
+ /**
392
+ Children permet de r�cup�rer tous les produits enfants
393
+ **/
394
+ public function getXmlChild()
395
+ {
396
+ /* Load Model and Helper */
397
+ $beezup = Mage::getModel('beezup/products');
398
+ $helper = Mage::helper('beezup');
399
+
400
+ /* Initially load the useful elements */
401
+ $many_images = $helper->getConfig('beezup/flux/images');
402
+ $_ht = $helper->getConfig('beezup/flux/ht');
403
+ $_description = $helper->getConfig('beezup/flux/description');
404
+ $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
405
+ $categories = Mage::getModel('catalog/category')->getCollection()
406
+ ->addAttributeToSelect('*')//or you can just add some attributes
407
+ ->addAttributeToFilter('level', 2)
408
+ ->addAttributeToFilter('is_active', 1);
409
+ $_categories = $beezup->getCategoriesAsArray( $categories );
410
+ $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
411
+ $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
412
+ $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
413
+
414
+ /* Build file */
415
+ $xml = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
416
+ $xml .= '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<catalog>' . PHP_EOL;
417
+
418
+ $childs = $beezup->getConfigurableProducts(false);
419
+
420
+ foreach ($childs as $c) {
421
+
422
+ //r�cup�rer l'image sur le p�re
423
+ $productParentIds=Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($c->getId());
424
+ foreach($productParentIds as $productParentId){
425
+ $productParent = Mage::getModel('catalog/product')->load($productParentId);
426
+ $image=$productParent->getImage();
427
+ $categories = $beezup->getProductsCategories($productParent, $_categories);
428
+ $url = $productParent->getProductUrl();
429
+ $name = $productParent->getName();
430
+ $description = $productParent->getData($_description);
431
+ }
432
+
433
+ if(count($categories)){
434
+ $qty = $beezup->getQty($c->getId());
435
+ $stock = $beezup->getIsInStock($qty);
436
+ $shipping = $beezup->getDelivery($qty);
437
+ $price = $c->getPrice();
438
+ $final_price = $c->getFinalPrice();
439
+ $image = $this->fillImageUrl($productParent, $c);
440
+
441
+ $xml .= '<product>';
442
+ $xml .= $helper->tag($this->__('b_unique_id'), $c->getId());
443
+ $xml .= $helper->tag($this->__('b_sku'), trim($c->getSku()), 1);
444
+
445
+ $xml .= $helper->tag($this->__('parent_or_child'), 'child', 1);
446
+ $xml .= $helper->tag($this->__('parent_id'), $c->getParentId());
447
+
448
+ $xml .= $helper->tag($this->__('b_title'), trim($name), 1);
449
+ $xml .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($description)), 1);
450
+ $xml .= $helper->tag($this->__('b_product_url'), $url, 1);
451
+
452
+ /*$inc = 0;
453
+ $product = Mage::getModel('catalog/product')->load( $c->getId());
454
+
455
+ foreach ($product->getMediaGalleryImages() as $image) {
456
+ $inc++;
457
+ if($inc==1) {
458
+ $xml .= $helper->tag($this->__('url_image'), $image->getUrl(), 1);
459
+ } else {
460
+ $xml .= $helper->tag($this->__('url_image')."_".$inc, $image->getUrl(), 1);
461
+ }
462
+ }*/
463
+ $xml .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1); //r�cup�re l'image sur le p�re
464
+
465
+ if($many_images == 1) {
466
+ $product = Mage::getModel('catalog/product')->load( $c->getId());
467
+ $inc = 1;
468
+ foreach ($product->getMediaGalleryImages() as $img) {
469
+ if($helper->getImageDir() . $image!== $img->getUrl()) {
470
+ $inc++;
471
+ $xml .= $helper->tag($this->__('url_image')."_".$inc, $img->getUrl(), 1);
472
+ }
473
+ }
474
+
475
+
476
+
477
+ }
478
+
479
+ $xml .= $helper->tag($this->__('b_availability'), $stock, 1);
480
+ $xml .= $helper->tag($this->__('b_qty'), $qty);
481
+ $xml .= $helper->tag($this->__('b_delivery'), $shipping, 1);
482
+ $xml .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($c->getWeight(), $_tablerates)));
483
+ $xml .= $helper->tag($this->__('b_weight'), $helper->currency($c->getWeight()));
484
+ $xml .= $helper->tag($this->__('b_price'), $helper->currency($final_price*$_vat));
485
+ if ($price != $final_price) $xml .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
486
+ $i = 1;
487
+ foreach ($categories as $v) $xml .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
488
+ foreach ($_attributes as $a) {
489
+ $value = $c->getResource()->getAttribute($a)->getFrontend()->getValue($c);
490
+ $xml .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
491
+ }
492
+
493
+ $xml .= '</product>' . PHP_EOL;
494
+ }
495
+ }
496
+
497
+ $xml .= '</catalog>';
498
+
499
+ return $xml;
500
+ }
501
+
502
+ /**
503
+ Produit groupes
504
+ **/
505
+
506
+ public function getAssociatedProducto($configurable)
507
+ {
508
+
509
+ /* Load Model and Helper */
510
+ $beezup = Mage::getModel('beezup/products');
511
+ $helper = Mage::helper('beezup');
512
+
513
+ /* Initially load the useful elements */
514
+ $many_images = $helper->getConfig('beezup/flux/images');
515
+ $_ht = $helper->getConfig('beezup/flux/ht');
516
+ $_description = $helper->getConfig('beezup/flux/description');
517
+ $_tablerates = $helper->getConfig('beezup/flux/tablerates_weight_destination') ? $beezup->getTablerates() : 0;
518
+ $_categories = $beezup->getCategoriesAsArray(Mage::helper('catalog/category')->getStoreCategories());
519
+ $_vat = ($_ht && is_numeric($helper->getConfig('beezup/flux/vat'))) ? (preg_replace('(\,+)', '.', $helper->getConfig('beezup/flux/vat')) / 100) + 1 : 1;
520
+ $_attributes = $helper->getConfig('beezup/flux/attributes') ? explode(',', $helper->getConfig('beezup/flux/attributes')) : array();
521
+ $_catalog_rules = $helper->getConfig('beezup/flux/catalog_rules');
522
+
523
+ $products = $beezup->getGroupedProduct();
524
+
525
+ $buf = $helper->getConfig('beezup/flux/bom') ? "\xEF\xBB\xBF" : '';
526
+ foreach ($products as $product) {
527
+ $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
528
+
529
+ $parentCategories = $beezup->getProductsCategories($product, $_categories);
530
+ $parentDesc = $product->getData($_description);
531
+ $parentId = $product->getId();
532
+ $parentImage = $product->getImage();
533
+ $parentUrl = $product->getProductUrl();
534
+
535
+ foreach ($associatedProducts as $g) {
536
+ $qty = $beezup->getQty($g->getId());
537
+ $stock = $beezup->getIsInStock($qty);
538
+ $shipping = $beezup->getDelivery($qty);
539
+ $price = $g->getPrice();
540
+ $final_price = $g->getFinalPrice();
541
+
542
+ $image = $this->fillImageUrl($product, $g);
543
+
544
+
545
+ //if (($image = $g->getImage()) == "no_selection" || ($image = $g->getImage()) == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
546
+ // $image = $g->getSmallImage();
547
+
548
+
549
+ //DBG
550
+ if (0)
551
+ {
552
+ echo "----------------------------" ."<br/>";
553
+ echo "Name : " .$g->getName() ."<br/>";
554
+ echo "Description : ".$parentDesc ."<br/>";
555
+ echo "Id : " .$g->getId() ."<br/>";
556
+ echo "Parent Id : " .$parentId ."<br/>";
557
+ echo "Url : " .$parentUrl ."<br/>";
558
+ echo "Image : " .$helper->getImageDir().$image ."<br/>";
559
+
560
+
561
+ echo "SKU : " .$g->getSku() ."<br/>";
562
+ echo "Quantity : " .$qty ."<br/>";
563
+ echo "Stock : " .$stock ."<br/>";
564
+ echo "Shipping : " .$shipping ."<br/>";
565
+ echo "price : " .$price ."<br/>";
566
+ echo "finalprice : ".$final_price ."<br/>";
567
+ echo "weight : " .$g->getWeight() ."<br/>";
568
+
569
+ $i = 1;
570
+ foreach ($parentCategories as $v)
571
+ echo "Cat�gorie ".$i." : ".$v."<br/>";
572
+ }
573
+
574
+
575
+ $buf .= "<product>";
576
+ $buf .= $helper->tag($this->__('b_unique_id'), $g->getId());
577
+ $buf .= $helper->tag($this->__('b_sku'), trim($g->getSku()), 1);
578
+ if ($configurable){
579
+ $buf .= $helper->tag($this->__('parent_or_child'), 'grouped_child', 1);
580
+ $buf .= $helper->tag($this->__('parent_id'), $parentId);
581
+ }
582
+ $buf .= $helper->tag($this->__('b_title'), $g->getName()/*trim($name)*/, 1);
583
+ $buf .= $helper->tag($this->__('b_description'), preg_replace("/(\r\n|\n|\r)/", ' ', strip_tags($parentDesc)), 1);
584
+ $buf .= $helper->tag($this->__('b_product_url'), $parentUrl, 1);
585
+
586
+ /*
587
+ if($many_images==1) {
588
+
589
+ $gprod = Mage::getModel('catalog/product')->load( $g->getId());
590
+ $inc = 0;
591
+ foreach ($gprod->getMediaGalleryImages() as $image) {
592
+ $inc++;
593
+ if($inc==1) {
594
+ $buf .= $helper->tag($this->__('url_image'), $image->getUrl(), 1);
595
+ } else {
596
+ $buf .= $helper->tag($this->__('url_image')."_".$inc, $image->getUrl(), 1);
597
+ }
598
+ }
599
+ } else {
600
+
601
+ $buf .= $helper->tag($this->__('url_image'), $helper->getImageDir() . $image, 1);
602
+ }*/
603
+
604
+ $buf .= $helper->tag($this->__('b_product_image'), $helper->getImageDir() . $image, 1); //r�cup�re l'image sur le p�re
605
+ $buf .= $helper->tag($this->__('b_availability'), $stock, 1);
606
+ $buf .= $helper->tag($this->__('b_qty'), $qty);
607
+ $buf .= $helper->tag($this->__('b_delivery'), $shipping, 1);
608
+ $buf .= $helper->tag($this->__('b_shipping'), $helper->currency($beezup->getShippingAmount($g->getWeight(), $_tablerates)));
609
+ $buf .= $helper->tag($this->__('b_weight'), $helper->currency($g->getWeight()));
610
+ $buf .= $helper->tag($this->__('b_price'), $helper->currency($final_price * $_vat));
611
+ if ($price != $final_price) $buf .= $helper->tag($this->__('b_regular_price'), $helper->currency($price*$_vat));
612
+ $i = 1;
613
+ foreach ($parentCategories as $v) $buf .= $helper->tag($this->__('b_category_%s', $i++), $v, 1);
614
+ foreach ($_attributes as $a) {
615
+ $value = $g->getResource()->getAttribute($a)->getFrontend()->getValue($g);
616
+ $buf .= $helper->tag($a, is_float($value) ? $helper->currency($value) : $value, is_float($value) ? 0 : 1);
617
+ }
618
+ $buf .= "</product>".PHP_EOL;
619
+ }
620
+ }
621
+ return $buf;
622
+ }
623
+
624
+
625
+ protected function fillImageUrl($p, $c)
626
+ {
627
+ $image = $c->getImage();
628
+ if ($image == "no_selection" || $image == "") // Si on ne trouve pas d'image avec getImage on r�cup�re la smallImage
629
+ {
630
+ $image = $c->getSmallImage();
631
+ if ($image == "no_selection" || $image == "")
632
+ {
633
+ $image = $p->getImage();
634
+ if ($image == "no_selection" || $image == "")
635
+ $image = $p->getSmallImage();
636
+ }
637
+ }
638
+ return ($image);
639
+ }
640
+
641
+ protected function createFile($type, $xmlData)
642
+ {
643
+ $fp = fopen('beezup/tmp/'.$type, 'w');
644
+ if ($fp == false)
645
+ {
646
+ echo 'Fail to create file';
647
+ }
648
+ fwrite($fp, $xmlData);
649
+ fclose($fp);
650
+ }
651
+
652
+ protected function deleteFeed($type)
653
+ {
654
+ unlink('beezup/tmp/'.$type);
655
+ }
656
+
657
+ protected function needRefreshing($type)
658
+ {
659
+ $helper = Mage::helper('beezup');
660
+
661
+ $delay = $helper->getConfig('beezup/flux/cachedelay') * 60;
662
+ $nowtime = time();
663
+ $fileTime = filemtime('beezup/tmp/'.$type);
664
+ if (($nowtime - $fileTime) >= $delay)
665
+ return (true);
666
+ else
667
+ return (false);
668
+ }
669
+
670
+ protected function createFolder()
671
+ {
672
+ $helper = Mage::helper('beezup');
673
+ if (!$helper->getConfig('beezup/flux/cachedelay')) // Si option cache desactiv�e, pas besoin du dossier
674
+ return (true);
675
+ if (file_exists('beezup/tmp')) // Si le dossier existe deja, pas besoin de le recr�er
676
+ return (true);
677
+ if (!mkdir('beezup/tmp', 0777, true))
678
+ {
679
+ echo "[ERROR] : Seems we can't create 'beezup' directory inside your root directory."."<br/>"
680
+ ."You can try one of these solutions :"."<br/>"
681
+ ."1 - Create by yourself the beezup/tmp inside your root directory with 777 permissions"."<br/>"
682
+ ."2 - Change the permissions on your root directory (777)"."<br/>"
683
+ ."3 - Change the 'cache delay' option to 'None' inside beezup plugin settings"."<br/>";
684
+ return (false);
685
+ }
686
+ return (true);
687
+ }
688
+
689
+
690
+
691
+ /**
692
+ C'est ici que tout commence ...
693
+ **/
694
+
695
+ protected function _toHtml()
696
+ {
697
+ set_time_limit(0);
698
+ $helper = Mage::helper('beezup');
699
+ $this->setCacheLifetime(null);
700
+ //dbg
701
+ /*
702
+ $this->getAssociatedProducto(true);
703
+ return;*/
704
+
705
+ if (!$this->createFolder()) // Si on rencontre des probl�mes de cr�ation de dossier on retourne rien
706
+ return;
707
+ if ($this->getConfigurable()){ // Appel de l'url http://site.com/beezup/catalog/configurable
708
+ if ($this->needRefreshing('configurable')){
709
+ if (file_exists('beezup/tmp/configurable'))
710
+ $this->deleteFeed('configurable');
711
+ $xmlData = $this->getXmlConfigurable();
712
+ $this->addText($xmlData);
713
+ if ($helper->getConfig('beezup/flux/cachedelay') != 0)
714
+ $this->createFile('configurable', $xmlData);
715
+ }
716
+ else
717
+ echo file_get_contents('beezup/tmp/configurable');
718
+ }
719
+ else if ($this->getChildXML()){ // Appel de l'url http://site.com/beezup/catalog/child
720
+ if ($this->needRefreshing('child')){
721
+ if (file_exists('beezup/tmp/child'))
722
+ $this->deleteFeed('child');
723
+ $xmlData = $this->getXmlChild();
724
+ $this->addText($xmlData);
725
+ if ($helper->getConfig('beezup/flux/cachedelay') != 0)
726
+ $this->createFile('child', $xmlData);
727
+ }
728
+ else
729
+ echo file_get_contents('beezup/tmp/child');
730
+ }
731
+ else { // Appel de l'url http://site.com/beezup/catalog/xml
732
+ if ($this->needRefreshing('xml')){
733
+ if (file_exists('beezup/tmp/xml'))
734
+ $this->deleteFeed('xml');
735
+ $xmlData = $this->getXml();
736
+ $this->addText($xmlData);
737
+ if ($helper->getConfig('beezup/flux/cachedelay') != 0)
738
+ $this->createFile('xml', $xmlData);
739
+ }
740
+ else
741
+ echo file_get_contents('beezup/tmp/xml');
742
+ }
743
+ return parent::_toHtml();
744
+ }
745
+ }
app/code/community/BeezUp/Helper/Data.php CHANGED
@@ -1,68 +1,68 @@
1
- <?php
2
-
3
- class BeezUp_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
-
6
- /*
7
- * Retrieve product image directory
8
- *
9
- * @return string
10
- */
11
- public function getImageDir()
12
- {
13
- return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product';
14
- }
15
-
16
- /*
17
- * Retrieve config path value
18
- *
19
- * @return string
20
- */
21
- public function getConfig($path = '')
22
- {
23
- if($path) {
24
- return Mage::getStoreConfig($path);
25
- }
26
- return '';
27
- }
28
-
29
- /*
30
- * Retrieve Remote Address
31
- *
32
- * @return string
33
- */
34
- public function getRemoteAddr()
35
- {
36
- return $_SERVER['REMOTE_ADDR'];
37
- }
38
-
39
- /*
40
- * Retrieve tag
41
- *
42
- * @param string $tagName
43
- * @param string $content
44
- * @param bool $cdata
45
- * @return string
46
- */
47
- public function tag($tagName, $content, $cdata = 0)
48
- {
49
- $result = '<' . $tagName . '>';
50
- if ($cdata) $result .= '<![CDATA[';
51
- $result .= preg_replace('(^' . $this->__('No') . '$)', '', trim($content));
52
- if ($cdata) $result .= ']]>';
53
- $result .= '</' . $tagName . '>';
54
- return $result;
55
- }
56
-
57
- /*
58
- * Format currency
59
- *
60
- * @param float $v
61
- * @return string
62
- */
63
- public function currency($v)
64
- {
65
- return number_format($v, 2, '.', '');
66
- }
67
-
68
  }
1
+ <?php
2
+
3
+ class BeezUp_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ /*
7
+ * Retrieve product image directory
8
+ *
9
+ * @return string
10
+ */
11
+ public function getImageDir()
12
+ {
13
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product';
14
+ }
15
+
16
+ /*
17
+ * Retrieve config path value
18
+ *
19
+ * @return string
20
+ */
21
+ public function getConfig($path = '')
22
+ {
23
+ if($path) {
24
+ return Mage::getStoreConfig($path);
25
+ }
26
+ return '';
27
+ }
28
+
29
+ /*
30
+ * Retrieve Remote Address
31
+ *
32
+ * @return string
33
+ */
34
+ public function getRemoteAddr()
35
+ {
36
+ return $_SERVER['REMOTE_ADDR'];
37
+ }
38
+
39
+ /*
40
+ * Retrieve tag
41
+ *
42
+ * @param string $tagName
43
+ * @param string $content
44
+ * @param bool $cdata
45
+ * @return string
46
+ */
47
+ public function tag($tagName, $content, $cdata = 0)
48
+ {
49
+ $result = '<' . $tagName . '>';
50
+ if ($cdata) $result .= '<![CDATA[';
51
+ $result .= preg_replace('(^' . $this->__('No') . '$)', '', trim($content));
52
+ if ($cdata) $result .= ']]>';
53
+ $result .= '</' . $tagName . '>';
54
+ return $result;
55
+ }
56
+
57
+ /*
58
+ * Format currency
59
+ *
60
+ * @param float $v
61
+ * @return string
62
+ */
63
+ public function currency($v)
64
+ {
65
+ return number_format($v, 2, '.', '');
66
+ }
67
+
68
  }
app/code/community/BeezUp/Model/Flatrate.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class BeezUp_Model_Flatrate extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
5
+ {
6
+
7
+ protected $_code = 'flatrate';
8
+ protected $_isFixed = true;
9
+
10
+
11
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
12
+ {
13
+ if (!$this->getConfigFlag('active')) {
14
+ return false;
15
+ }
16
+
17
+ $freeBoxes = 0;
18
+ if ($request->getAllItems()) {
19
+ foreach ($request->getAllItems() as $item) {
20
+
21
+ if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
22
+ continue;
23
+ }
24
+
25
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
26
+ foreach ($item->getChildren() as $child) {
27
+ if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
28
+ $freeBoxes += $item->getQty() * $child->getQty();
29
+ }
30
+ }
31
+ } elseif ($item->getFreeShipping()) {
32
+ $freeBoxes += $item->getQty();
33
+ }
34
+ }
35
+ }
36
+ $this->setFreeBoxes($freeBoxes);
37
+
38
+ $result = Mage::getModel('shipping/rate_result');
39
+ if ($this->getConfigData('type') == 'O') { // per order
40
+ $shippingPrice = $this->getConfigData('price');
41
+ } elseif ($this->getConfigData('type') == 'I') { // per item
42
+ $shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
43
+ } else {
44
+ $shippingPrice = false;
45
+ }
46
+
47
+ $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
48
+
49
+ if ($shippingPrice !== false) {
50
+ $method = Mage::getModel('shipping/rate_result_method');
51
+
52
+ $method->setCarrier('flatrate');
53
+ $method->setCarrierTitle($this->getConfigData('title'));
54
+
55
+ $method->setMethod('flatrate');
56
+ $method->setMethodTitle($this->getConfigData('name'));
57
+
58
+ if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
59
+ $shippingPrice = '0.00';
60
+ }
61
+
62
+ if(Mage::registry('shipping_cost'))
63
+ {
64
+ if(Mage::registry('shipping_cost') == 20000) {
65
+ $method->setPrice('0.00');
66
+ $method->setCost('0.00');
67
+ } else {
68
+ $method->setPrice(Mage::registry('shipping_cost'));
69
+ $method->setCost(Mage::registry('shipping_cost'));
70
+ }
71
+ } else {
72
+ $method->setPrice($shippingPrice);
73
+ $method->setCost($shippingPrice);
74
+ }
75
+
76
+ $result->append($method);
77
+ }
78
+
79
+ return $result;
80
+ }
81
+
82
+
83
+ public function getAllowedMethods()
84
+ {
85
+
86
+ return array('flatrate'=>$this->getConfigData('name'));
87
+ }
88
+
89
+
90
+
91
+ }
app/code/community/BeezUp/Model/Observer.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
-
3
- class BeezUp_Model_Observer
4
- {
5
-
6
- public function addBlockTracking($observer)
7
- {
8
- if (!Mage::getStoreConfigFlag('beezup/tracking/active') || !Mage::getStoreConfig('beezup/tracking/storeid')) return '';
9
-
10
- $layout = $observer->getLayout();
11
- $blockParent = $layout->getXpath("//block[@name='".Mage::getStoreConfig('beezup/tracking/position')."']");
12
-
13
- if (!$blockParent) return $this;
14
-
15
- $block = $blockParent[0]->addChild('block');
16
- $block->addAttribute('type', 'beezup/tracking');
17
- $block->addAttribute('name', 'beezup_tracking');
18
- $block->addAttribute('as', 'beezup_tracking');
19
- }
20
-
21
- public function addOrder($observer)
22
- {
23
- if (!Mage::getStoreConfigFlag('beezup/tracking/active') || !Mage::getStoreConfig('beezup/tracking/storeid')) return '';
24
-
25
- $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
26
- $beezupBlock = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('beezup_tracking');
27
- if ($order && $beezupBlock) {
28
- $beezupBlock->setOrder($order);
29
- }
30
- }
31
-
32
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_Observer
4
+ {
5
+
6
+ public function addBlockTracking($observer)
7
+ {
8
+ if (!Mage::getStoreConfigFlag('beezup/tracking/active') || !Mage::getStoreConfig('beezup/tracking/storeid')) return '';
9
+
10
+ $layout = $observer->getLayout();
11
+ $blockParent = $layout->getXpath("//block[@name='".Mage::getStoreConfig('beezup/tracking/position')."']");
12
+
13
+ if (!$blockParent) return $this;
14
+
15
+ $block = $blockParent[0]->addChild('block');
16
+ $block->addAttribute('type', 'beezup/tracking');
17
+ $block->addAttribute('name', 'beezup_tracking');
18
+ $block->addAttribute('as', 'beezup_tracking');
19
+ }
20
+
21
+ public function addOrder($observer)
22
+ {
23
+ if (!Mage::getStoreConfigFlag('beezup/tracking/active') || !Mage::getStoreConfig('beezup/tracking/storeid')) return '';
24
+
25
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
26
+ $beezupBlock = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('beezup_tracking');
27
+ if ($order && $beezupBlock) {
28
+ $beezupBlock->setOrder($order);
29
+ }
30
+ }
31
+
32
  }
app/code/community/BeezUp/Model/Products.php CHANGED
@@ -1,292 +1,321 @@
1
- <?php
2
-
3
- class BeezUp_Model_Products extends Mage_Core_Model_Abstract
4
- {
5
-
6
- /*
7
- * Retrieve products collection
8
- *
9
- * @param bool $configurable
10
- * @return Mage_Catalog_Model_Resource_Product_Collection?
11
- */
12
- public function getProducts($configurable = false)
13
- {
14
- $products = Mage::getResourceModel('catalog/product_collection')
15
- ->addAttributeToFilter('status', 1)
16
- ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
17
- ->addAttributeToFilter('price', array('neq' => 0))
18
- ->addAttributeToSelect('name')
19
- ->addAttributeToSelect('weight')
20
- ->addAttributeToSelect('sku')
21
- ->addAttributeToSelect('special_price')
22
- ->addAttributeToSelect('special_from_date')
23
- ->addAttributeToSelect('special_to_date')
24
- ->addAttributeToSelect('small_image')
25
- ->addAttributeToSelect('image')
26
- ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
27
- ->addStoreFilter();
28
- /* $products = Mage::getModel('catalog/product')
29
- ->getCollection();
30
-
31
- */
32
- if($configurable) $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
33
-
34
- if(Mage::getStoreConfig('beezup/flux/stock')){
35
- $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
36
- ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
37
- }
38
-
39
- $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
40
- foreach ($attributes as $a) $products->addAttributeToSelect($a);
41
-
42
- if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
43
-
44
- return $products;
45
- }
46
-
47
- public function getGroupedProduct()
48
- {
49
- $products = Mage::getModel('catalog/product')
50
- ->getCollection()
51
- ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
52
- ->addAttributeToFilter('type_id', array('eq' => 'grouped'));
53
-
54
-
55
- return $products;
56
- }
57
-
58
- public function getProductsSimple()
59
- {
60
- $products = Mage::getResourceModel('catalog/product_collection')
61
- ->addAttributeToFilter('status', 1)
62
- ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
63
- ->addAttributeToFilter('price', array('neq' => 0))
64
- ->addAttributeToSelect('name')
65
- ->addAttributeToSelect('weight')
66
- ->addAttributeToSelect('sku')
67
- ->addAttributeToSelect('special_price')
68
- ->addAttributeToSelect('special_from_date')
69
- ->addAttributeToSelect('special_to_date')
70
- ->addAttributeToSelect('small_image')
71
- ->addAttributeToSelect('image')
72
- ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
73
- ->addStoreFilter();
74
-
75
- $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);
76
-
77
- if(Mage::getStoreConfig('beezup/flux/stock')){
78
- $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
79
- ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
80
- }
81
-
82
- $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
83
- foreach ($attributes as $a) $products->addAttributeToSelect($a);
84
-
85
- if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
86
-
87
- return $products;
88
- }
89
-
90
- /*
91
- * Retrieve configurable products collection
92
- *
93
- * @return Mage_Catalog_Model_Resource_Product_Collection?
94
- */
95
- public function getConfigurableProducts($config = true) {
96
- $products = Mage::getResourceModel('catalog/product_type_configurable_product_collection')
97
- ->addAttributeToFilter('status', 1)
98
- ->addAttributeToFilter('price', array('neq' => 0))
99
- ->addAttributeToSelect('name')
100
- ->addAttributeToSelect('weight')
101
- ->addAttributeToSelect('sku')
102
- ->addAttributeToSelect('special_from_date')
103
- ->addAttributeToSelect('special_to_date')
104
- ->addAttributeToSelect('special_price')
105
- ->addAttributeToSelect('small_image')
106
- ->addAttributeToSelect('image')
107
- ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
108
- ->addStoreFilter();
109
-
110
- if(Mage::getStoreConfig('beezup/flux/stock')){
111
- $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
112
- ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
113
- }
114
-
115
- $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
116
- foreach ($attributes as $a) $products->addAttributeToSelect($a);
117
-
118
- $productsArray = $products;
119
-
120
- //si on est dans le cas o� on veut les p�res et les fils
121
- if($config){
122
- $productsArray = array();
123
-
124
- foreach($products as $p) {
125
- $productsArray[$p->getParentId()][] = $p;
126
- }
127
- }
128
-
129
- return $productsArray;
130
- }
131
-
132
- /*
133
- * Collect options applicable to the configurable product for Varation Theme
134
- *
135
- * @param Mage_Catalog_Model_Product $product
136
- * @return String
137
- */
138
-
139
- public function getOptions($product) {
140
- $childs = $this->getConfigurableProducts();
141
-
142
- //si c'est un parent
143
- if(isset($childs[$product->getId()])) {
144
- $productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
145
-
146
- $attributeOptions = array();
147
-
148
- foreach ($productAttributeOptions as $productAttribute) {
149
- $attributeOptions[] = ucfirst($productAttribute['attribute_code']);
150
- }
151
-
152
- return implode('',$attributeOptions);
153
- }
154
- }
155
-
156
- /*
157
- * Retrieve products stock
158
- *
159
- * @param int $id
160
- * @param int $qty
161
- * @return int
162
- */
163
- public function getQty($productId, $qty = 0)
164
- {
165
- $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
166
- if ($stockItem->getManageStock()) {
167
- if ($stockItem->getIsInStock()) {
168
- $qty = intval($stockItem->getQty());
169
- $qty = ($qty <= 0) ? 0 : $qty;
170
- }
171
- } else {
172
- $qty = 100;
173
- }
174
- return $qty;
175
- }
176
-
177
- /*
178
- * Retrieve product shipping amount
179
- *
180
- * @param float $weight
181
- * @param Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection $tablerates
182
- * @return float
183
- */
184
- public function getShippingAmount($weight, $tablerates)
185
- {
186
- $shipping_amount = 0;
187
-
188
- if ($tablerates && $tablerates instanceof Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection) {
189
- foreach ($tablerates as $t) {
190
- if ($weight <= $t->getConditionValue()) $shipping_amount = $t->getPrice();
191
- }
192
- } else {
193
- $shipping_amount = preg_replace('(\,+)', '.', trim(Mage::getStoreConfig('beezup/flux/ship')));
194
- if (!is_numeric($shipping_amount)) $shipping_amount = 0;
195
- }
196
- return $shipping_amount;
197
- }
198
-
199
- /*
200
- * Retrieve Tablerates
201
- *
202
- * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
203
- */
204
- public function getTablerates()
205
- {
206
- return Mage::getResourceModel('shipping/carrier_tablerate_collection')->setOrder('condition_value', 'desc');
207
- }
208
-
209
- /*
210
- * Retrieve product is in stock
211
- *
212
- * @param float $qty
213
- * @return string
214
- */
215
- public function getIsInStock($qty)
216
- {
217
- return ($qty > 0) ? Mage::helper('beezup')->__('In Stock') : Mage::helper('beezup')->__('Out of Stock');
218
- }
219
-
220
- /*
221
- * Retrieve product delivery
222
- *
223
- * @param float $qty
224
- * @return string
225
- */
226
- public function getDelivery($qty)
227
- {
228
- return ($qty > 0) ? Mage::getStoreConfig('beezup/flux/days_in') : Mage::getStoreConfig('beezup/flux/days_out');
229
- }
230
-
231
- /*
232
- * Retrieve store categories as array (recursive)
233
- *
234
- * @param Varien_Data_Tree_Node_Collection $categories
235
- * @param string $parent
236
- * @param array $cats
237
- * @return string
238
- */
239
- public function getCategoriesAsArray($categories, $parent = '', &$cats = array())
240
- {
241
- foreach ($categories as $c) {
242
- $cats[$c['entity_id']] = $parent . $c['name'];
243
-
244
- if (!Mage::helper('catalog/category_flat')->isEnabled()) {
245
- if ($childs = $c->getChildren()) {
246
- $this->getCategoriesAsArray($childs, $parent . $c['name'] . '||', $cats);
247
- }
248
- } else {
249
- if (isset($c['children_nodes'])) {
250
- $this->getCategoriesAsArray($c['children_nodes'], $parent . $c['name'] . '||', $cats);
251
- }
252
- }
253
- }
254
- return $cats;
255
- }
256
-
257
- /*
258
- * Retrieve product categories
259
- *
260
- * @param Mage_Catalog_Model_Product $product
261
- * @param array $categories
262
- * @return array
263
- */
264
- public function getProductsCategories($product,$categories)
265
- {
266
- $_categories = $product->getCategoryIds();
267
-
268
- sort($_categories);
269
- $result = array();
270
- if(count($_categories)) {
271
- $_count = 0;
272
- foreach($_categories as $c) {
273
- if(isset($categories[$c])) {
274
- if(count(explode('||',$categories[$c])) > $_count) $result = explode('||',$categories[$c]);
275
- $_count = count($result);
276
- }
277
- }
278
- }
279
- return $result;
280
- }
281
-
282
- /*
283
- * Retrieve current store
284
- *
285
- * @return Mage_Core_Model_Store
286
- */
287
- public function getStore()
288
- {
289
- return Mage::app()->getStore();
290
- }
291
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_Products extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ /*
7
+ * Retrieve products collection
8
+ *
9
+ * @param bool $configurable
10
+ * @return Mage_Catalog_Model_Resource_Product_Collection?
11
+ */
12
+ public function getProducts($configurable = false)
13
+ {
14
+ $products = Mage::getResourceModel('catalog/product_collection')
15
+ ->addAttributeToFilter('status', 1)
16
+ ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
17
+ ->addAttributeToFilter('price', array('neq' => 0))
18
+ ->addAttributeToSelect('name')
19
+ ->addAttributeToSelect('weight')
20
+ ->addAttributeToSelect('sku')
21
+ ->addAttributeToSelect('special_price')
22
+ ->addAttributeToSelect('special_from_date')
23
+ ->addAttributeToSelect('special_to_date')
24
+ ->addAttributeToSelect('small_image')
25
+ ->addAttributeToSelect('image')
26
+ ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
27
+ ->addStoreFilter();
28
+
29
+ if($configurable) $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
30
+
31
+ if(Mage::getStoreConfig('beezup/flux/stock')){
32
+ $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
33
+ ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
34
+ }
35
+
36
+ $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
37
+ foreach ($attributes as $a) $products->addAttributeToSelect($a);
38
+
39
+ if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
40
+
41
+ return $products;
42
+ }
43
+
44
+ public function getGroupedProduct()
45
+ {
46
+ $products = Mage::getModel('catalog/product')
47
+ ->getCollection()
48
+ ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
49
+ ->addAttributeToFilter('type_id', array('eq' => 'grouped'));
50
+
51
+
52
+ return $products;
53
+ }
54
+
55
+ public function getProductsSimple()
56
+ {
57
+ $products = Mage::getResourceModel('catalog/product_collection')
58
+ ->addAttributeToFilter('status', 1)
59
+ ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
60
+ ->addAttributeToFilter('price', array('neq' => 0))
61
+ ->addAttributeToSelect('name')
62
+ ->addAttributeToSelect('weight')
63
+ ->addAttributeToSelect('sku')
64
+ ->addAttributeToSelect('special_price')
65
+ ->addAttributeToSelect('special_from_date')
66
+ ->addAttributeToSelect('special_to_date')
67
+ ->addAttributeToSelect('small_image')
68
+ ->addAttributeToSelect('image')
69
+ ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
70
+ ->addStoreFilter();
71
+
72
+ $products->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);
73
+
74
+ if(Mage::getStoreConfig('beezup/flux/stock')){
75
+ $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
76
+ ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
77
+ }
78
+
79
+ $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
80
+ foreach ($attributes as $a) $products->addAttributeToSelect($a);
81
+
82
+ if (Mage::getStoreConfig('beezup/flux/debug_flux')) $products->setPageSize(10);
83
+
84
+ return $products;
85
+ }
86
+
87
+ /*
88
+ * Retrieve configurable products collection
89
+ *
90
+ * @return Mage_Catalog_Model_Resource_Product_Collection?
91
+ */
92
+ public function getConfigurableProducts($config = true) {
93
+ $products = Mage::getResourceModel('catalog/product_type_configurable_product_collection')
94
+ ->addAttributeToFilter('status', 1)
95
+ ->addAttributeToFilter('price', array('neq' => 0))
96
+ ->addAttributeToSelect('name')
97
+ ->addAttributeToSelect('weight')
98
+ ->addAttributeToSelect('sku')
99
+ ->addAttributeToSelect('special_from_date')
100
+ ->addAttributeToSelect('special_to_date')
101
+ ->addAttributeToSelect('special_price')
102
+ ->addAttributeToSelect('small_image')
103
+ ->addAttributeToSelect('image')
104
+ ->addAttributeToSelect(Mage::getStoreConfig('beezup/flux/description'))
105
+ ->addStoreFilter();
106
+
107
+ if(Mage::getStoreConfig('beezup/flux/stock')){
108
+ $products= $products->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')
109
+ ->addAttributeToFilter('inventory_in_stock', array('neq' => 0));
110
+ }
111
+
112
+ $attributes = explode(',', Mage::getStoreConfig('beezup/flux/attributes'));
113
+ foreach ($attributes as $a) $products->addAttributeToSelect($a);
114
+
115
+ $productsArray = $products;
116
+
117
+ //si on est dans le cas o� on veut les p�res et les fils
118
+ if($config){
119
+ $productsArray = array();
120
+
121
+ foreach($products as $p) {
122
+ $productsArray[$p->getParentId()][] = $p;
123
+ }
124
+ }
125
+
126
+ return $productsArray;
127
+ }
128
+
129
+ /*
130
+ * Collect options applicable to the configurable product for Varation Theme
131
+ *
132
+ * @param Mage_Catalog_Model_Product $product
133
+ * @return String
134
+ */
135
+
136
+ public function getOptions($product) {
137
+ $childs = $this->getConfigurableProducts();
138
+
139
+ //si c'est un parent
140
+ if(isset($childs[$product->getId()])) {
141
+ $productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
142
+
143
+ $attributeOptions = array();
144
+
145
+ foreach ($productAttributeOptions as $productAttribute) {
146
+ $attributeOptions[] = ucfirst($productAttribute['attribute_code']);
147
+ }
148
+
149
+ return implode('',$attributeOptions);
150
+ }
151
+ }
152
+
153
+ /*
154
+ * Retrieve products stock
155
+ *
156
+ * @param int $id
157
+ * @param int $qty
158
+ * @return int
159
+ */
160
+ public function getQty($productId, $qty = 0)
161
+ {
162
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
163
+ if ($stockItem->getManageStock()) {
164
+ if ($stockItem->getIsInStock()) {
165
+ $qty = intval($stockItem->getQty());
166
+ $qty = ($qty <= 0) ? 0 : $qty;
167
+ }
168
+ } else {
169
+ $qty = 100;
170
+ }
171
+ return $qty;
172
+ }
173
+
174
+ /*
175
+ * Retrieve product shipping amount
176
+ *
177
+ * @param float $weight
178
+ * @param Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection $tablerates
179
+ * @return float
180
+ */
181
+ public function getShippingAmount($weight, $tablerates)
182
+ {
183
+ $shipping_amount = 0;
184
+
185
+ if ($tablerates && $tablerates instanceof Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection) {
186
+ foreach ($tablerates as $t) {
187
+ if ($weight <= $t->getConditionValue()) $shipping_amount = $t->getPrice();
188
+ }
189
+ } else {
190
+ $shipping_amount = preg_replace('(\,+)', '.', trim(Mage::getStoreConfig('beezup/flux/ship')));
191
+ if (!is_numeric($shipping_amount)) $shipping_amount = 0;
192
+ }
193
+ return $shipping_amount;
194
+ }
195
+
196
+ /*
197
+ * Retrieve Tablerates
198
+ *
199
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
200
+ */
201
+ public function getTablerates()
202
+ {
203
+ return Mage::getResourceModel('shipping/carrier_tablerate_collection')->setOrder('condition_value', 'desc');
204
+ }
205
+
206
+ /*
207
+ * Retrieve product is in stock
208
+ *
209
+ * @param float $qty
210
+ * @return string
211
+ */
212
+ public function getIsInStock($qty)
213
+ {
214
+ return ($qty > 0) ? Mage::helper('beezup')->__('In Stock') : Mage::helper('beezup')->__('Out of Stock');
215
+ }
216
+
217
+ /*
218
+ * Retrieve product delivery
219
+ *
220
+ * @param float $qty
221
+ * @return string
222
+ */
223
+ public function getDelivery($qty)
224
+ {
225
+ return ($qty > 0) ? Mage::getStoreConfig('beezup/flux/days_in') : Mage::getStoreConfig('beezup/flux/days_out');
226
+ }
227
+
228
+ /*
229
+ * Retrieve store categories as array (recursive)
230
+ *
231
+ * @param Varien_Data_Tree_Node_Collection $categories
232
+ * @param string $parent
233
+ * @param array $cats
234
+ * @return string
235
+ */
236
+ public function getCategoriesAsArray($_categories, $tl_name = '')
237
+ {
238
+
239
+ $parent = 0;
240
+ $i = 0;
241
+ foreach($_categories as $_category){
242
+
243
+ if($i==0 ) {
244
+ $par_cat = Mage::getModel('catalog/category')->load($_category->getId())->getParentCategory();
245
+ $cats[$par_cat->getId()] = array("name" => $tl_name.$par_cat->getName(), "id" => $par_cat->getId(), "parent" => $par_cat->getParentId());
246
+ }
247
+
248
+
249
+ //$_category = Mage::getModel('catalog/category')->load($_category->getId());
250
+ $cats[$_category->getId()] = array("name" => $tl_name.$_category->getName(), "id" => $_category->getId(), "parent" => $_category->getParentId() ); //Toplevel auslesen
251
+ $i++;
252
+ $_category = Mage::getModel('catalog/category')->load($_category->getId());
253
+ $subcats = $this->getChildCategories($_category);
254
+
255
+ foreach($subcats as $c) {
256
+
257
+ $cats[$c['id']] = array("name" => $tl_name.$c['name'], "id" => $c['id'] , "parent" => $c['parent']);
258
+ }
259
+ }
260
+ return $cats;
261
+ }
262
+
263
+ public $_catIds = array();
264
+ public function getChildCategories($categoryObject){
265
+ $categories = $categoryObject->getChildrenCategories();
266
+ foreach ($categories as $catgory){
267
+ if($catgory->hasChildren()){
268
+ $this->getChildCategories($catgory);
269
+ }
270
+ $this->_catIds[] = array("id" => $catgory->getId(), "name" => $catgory->getName(), "parent" => $catgory->getParentId());
271
+ }
272
+ return $this->_catIds;
273
+ }
274
+
275
+ /*
276
+ * Retrieve product categories
277
+ *
278
+ * @param Mage_Catalog_Model_Product $product
279
+ * @param array $categories
280
+ * @return array
281
+ */
282
+ public function getProductsCategories($product,$categories)
283
+ {
284
+ $result = array();
285
+ $_categories = $product->getCategoryIds();
286
+ $parent_id = 0;
287
+ $parent_id = 0;
288
+ $i = 0;
289
+ sort($_categories);
290
+
291
+ if(count($_categories)) {
292
+ $_count = 0;
293
+ foreach($_categories as $c) {
294
+ if(isset($categories[$c])) {
295
+ if( $parent_id == $categories[$c]['parent'] || $i <= 1) {
296
+ $result[] = $categories[$c]['name'];
297
+
298
+
299
+ $parent_id = $categories[$c]['id'];
300
+
301
+ }
302
+ $i++;
303
+ // if(count(explode('||',$categories[$c])) > $_count) $result = explode('||',$categories[$c]);
304
+ $_count = count($result);
305
+ }
306
+ }
307
+ }
308
+ return $result;
309
+ }
310
+
311
+ /*
312
+ * Retrieve current store
313
+ *
314
+ * @return Mage_Core_Model_Store
315
+ */
316
+ public function getStore()
317
+ {
318
+ return Mage::app()->getStore();
319
+ }
320
+
321
  }
app/code/community/BeezUp/Model/Quote/Item.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_Quote_Item extends Mage_Sales_Model_Quote_Item {
4
+
5
+
6
+ public function setBeezupPrice($value) {
7
+ $shop = $this->getQuote()->getStore();
8
+
9
+ if (!Mage::helper('tax')->priceIncludesTax($shop)) {
10
+
11
+ $amount_deee = 0;
12
+ if (!Mage::helper('tax')->priceIncludesTax($shop)) {
13
+ $wee_helper = Mage::helper('weee');
14
+ $amount_deee = $wee_helper->getAmount($this->getProduct());
15
+ }
16
+ $shippingaddress = $this->getQuote()->getShippingAddress();
17
+
18
+ $billingaddress = $this->getQuote()->getBillingAddress();
19
+
20
+ $beezup_address = $this->getAddress();
21
+ if ($beezup_address) {
22
+ switch ($beezup_address->getAddressType()) {
23
+ case Mage_Sales_Model_Quote_Address::TYPE_SHIPPING:
24
+ $shippingaddress = $beezup_address;
25
+ break;
26
+ case Mage_Sales_Model_Quote_Address::TYPE_BILLING:
27
+ $billingaddress = $beezup_address;
28
+ break;
29
+
30
+ }
31
+ }
32
+
33
+ if ($this->getProduct()->getIsVirtual()) {
34
+ $shippingaddress = $billingaddress;
35
+ }
36
+
37
+ $PriceTaxExcluded = Mage::helper('tax')->getPrice(
38
+ $this->getProduct()->setTaxPercent(null),
39
+ $value,
40
+ false,
41
+ $shippingaddress,
42
+ $billingaddress,
43
+ $this->getQuote()->getCustomerTaxClassId(),
44
+ $shop,
45
+ true
46
+ ) - $amount_deee;
47
+
48
+ $PriceTaxIncluded = Mage::helper('tax')->getPrice(
49
+ $this->getProduct()->setTaxPercent(null),
50
+ $value,
51
+ true,
52
+ $shippingaddress,
53
+ $billingaddress,
54
+ $this->getQuote()->getCustomerTaxClassId(),
55
+ $shop,
56
+ true
57
+ );
58
+
59
+ $this->setCustomPrice($PriceTaxExcluded);
60
+
61
+ $this->setOriginalPrice($PriceTaxExcluded);
62
+
63
+ $this->setOriginalCustomPrice($PriceTaxExcluded);
64
+
65
+ $quantity = $this->getQty();
66
+ if ($this->getParentItem()) {
67
+ $quantity = $quantity*$this->getParentItem()->getQty();
68
+ }
69
+
70
+ $beezup_rowTotal = $value * $quantity;
71
+ $beezup_rowTotalExcTax = Mage::helper('tax')->getPrice(
72
+ $this->getProduct()->setTaxPercent(null),
73
+ $beezup_rowTotal,
74
+ false,
75
+ $shippingaddress,
76
+ $billingaddress,
77
+ $this->getQuote()->getCustomerTaxClassId(),
78
+ $shop,
79
+ true
80
+ ) - ($amount_deee * $quantity);
81
+ $beezup_rowTotalIncTax = Mage::helper('tax')->getPrice(
82
+ $this->getProduct()->setTaxPercent(null),
83
+ $beezup_rowTotal,
84
+ true,
85
+ $shippingaddress,
86
+ $billingaddress,
87
+ $this->getQuote()->getCustomerTaxClassId(),
88
+ $shop,
89
+ true
90
+ );
91
+ $beezup_totalBaseTax = $beezup_rowTotalIncTax-$beezup_rowTotalExcTax;
92
+ $taxAmount = $PriceTaxIncluded - $PriceTaxExcluded ;
93
+ $beezup_totalBaseTax = $taxAmount*$quantity;
94
+ $totalTax = $this->getStore()->convertPrice($beezup_totalBaseTax);
95
+
96
+ $this->setTaxPercent($this->getProduct()->getTaxPercent());
97
+ $this->setBaseRowTotalInclTax($beezup_rowTotal);
98
+ $this->setBaseRowTotal($beezup_rowTotal);
99
+ $this->setBaseTaxBeforeDiscount($beezup_totalBaseTax);
100
+ $this->setTaxBeforeDiscount($totalTax);
101
+ $this->setBaseTaxAmount($beezup_totalBaseTax);
102
+ $this->setTaxAmount($totalTax);
103
+ $this->setBaseOriginalPrice($PriceTaxExcluded);
104
+ $this->setTaxAmount($totalTax);
105
+ $this->setPriceInclTax($PriceTaxIncluded);
106
+ $this->setBasePriceInclTax($PriceTaxIncluded);
107
+ $this->setPrice($PriceTaxExcluded);
108
+ return $this;
109
+ } else {
110
+ return $this;
111
+ }
112
+ }
113
+
114
+
115
+ }
app/code/community/BeezUp/Model/Sales/Order/Pdf/Invoice.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_Sales_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Invoice {
4
+
5
+
6
+ protected function insertTotals($page, $source){
7
+ $order = $source->getOrder();
8
+ $totals = $this->_getTotalsList($source);
9
+ $lineBlock = array(
10
+ 'lines' => array(),
11
+ 'height' => 15
12
+ );
13
+
14
+ $id = $order->getQuoteId();
15
+ $resource = Mage::getSingleton('core/resource');
16
+ $readConnection = $resource->getConnection('core_read');
17
+ $table = $resource->getTableName('sales/quote_address');
18
+ $query = 'SELECT beezup_fee FROM ' . $table . ' WHERE quote_id = '.$id.' and address_type = \'shipping\' LIMIT 1';
19
+ $fee = $readConnection->fetchOne($query);
20
+
21
+ $grand_total = $order->getGrandTotal();
22
+ $grand_format_total = Mage::helper('core')->currency($grand_total, true, false);
23
+ $i = 0;
24
+ foreach ($totals as $total) {
25
+ if($i == 1 && $fee>0) {
26
+ $format_fee = Mage::helper('core')->currency($fee, true, false);
27
+ $lineBlock['lines'][] = array(
28
+ array(
29
+ 'text' => "Frais de Gestion Cdiscount",
30
+ 'feed' => 475,
31
+ 'align' => 'right',
32
+ 'font_size' => $totalData['font_size'],
33
+ 'font' => 'bold'
34
+ ),
35
+ array(
36
+ 'text' => $format_fee,
37
+ 'feed' => 565,
38
+ 'align' => 'right',
39
+ 'font_size' =>$totalData['font_size'] ,
40
+ 'font' => 'bold'
41
+ ),
42
+ );
43
+ }
44
+ $total->setOrder($order)
45
+ ->setSource($source);
46
+
47
+ if ($total->canDisplay()) {
48
+ $total->setFontSize(10);
49
+ $c = 0;
50
+ foreach ($total->getTotalsForDisplay() as $totalData) {
51
+
52
+ $amount = $totalData['amount'];
53
+ if( $grand_format_total == $amount && $fee >0 && $i > 0) {
54
+
55
+ $amount = $grand_total + $fee;
56
+ $amount = Mage::helper('core')->currency($amount, true, false);
57
+ }
58
+ $lineBlock['lines'][] = array(
59
+ array(
60
+ 'text' => $totalData['label'],
61
+ 'feed' => 475,
62
+ 'align' => 'right',
63
+ 'font_size' => $totalData['font_size'],
64
+ 'font' => 'bold'
65
+ ),
66
+ array(
67
+ 'text' => $amount,
68
+ 'feed' => 565,
69
+ 'align' => 'right',
70
+ 'font_size' => $totalData['font_size'],
71
+ 'font' => 'bold'
72
+ ),
73
+ );
74
+ $c++;
75
+ }
76
+ }
77
+ $i++;
78
+ }
79
+
80
+ $this->y -= 20;
81
+ $page = $this->drawLineBlocks($page, array($lineBlock));
82
+ return $page;
83
+ }
84
+
85
+
86
+
87
+ }
app/code/community/BeezUp/Model/System/Config/Backend/Attributes.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Beezup_Model_System_Config_Backend_Attributes extends Mage_Core_Model_Config_Data
3
+ {
4
+ protected function _afterLoad()
5
+ {
6
+
7
+ if (!is_array($this->getValue())) {
8
+ $value = $this->getValue();
9
+ $this->setValue(empty($value) ? false : unserialize($value));
10
+ }
11
+ }
12
+
13
+ protected function _beforeSave()
14
+ {
15
+
16
+ // Mage::getSingleton('core/session')->addError("Error");
17
+ if (is_array($this->getValue())) {
18
+
19
+ $this->setValue(serialize($this->getValue()));
20
+ }
21
+ }
22
+
23
+
24
+
25
+
26
+ }
app/code/community/BeezUp/Model/System/Config/Backend/Credentials.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname ( __FILE__ ) . "/../../../../lib/bootstrap.php";
4
+ require_once dirname ( __FILE__ ) . "/../../../../lib/BeezupRepository.php";
5
+
6
+
7
+ class Beezup_Model_System_Config_Backend_Credentials extends Mage_Core_Model_Config_Data
8
+ {
9
+
10
+
11
+ protected function _afterLoad()
12
+ {
13
+ $repository = new BeezupRepository();
14
+ if($repository->isConnectionOk()) {
15
+ $this->setValue(1);
16
+ } else {
17
+ $this->setValue(0);
18
+ }
19
+
20
+ }
21
+
22
+ protected function _beforeSave()
23
+ {
24
+ $repository = new BeezupRepository();
25
+ if($repository->isConnectionOk()) {
26
+ $this->setValue(1);
27
+ } else {
28
+ $this->setValue(0);
29
+ }
30
+ }
31
+
32
+ }
app/code/community/BeezUp/Model/System/Config/Backend/Time.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Beezup_Model_System_Config_Backend_Time extends Mage_Core_Model_Config_Data
3
+ {
4
+ protected function _afterLoad()
5
+ {
6
+
7
+ $this->setValue( $this->getValue());
8
+
9
+
10
+ }
11
+
12
+ protected function _beforeSave()
13
+ {
14
+ $value = $this->getValue();
15
+ if(strtotime($value)) {
16
+ $oDateTime = new DateTime($value, new DateTimeZone('UTC'));
17
+ if ($oDateTime->getTimestamp()){
18
+ $this->setValue($oDateTime->getTimestamp());
19
+ }
20
+ }
21
+ }
22
+
23
+ }
app/code/community/BeezUp/Model/System/Config/Backend/Token.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Beezup_Model_System_Config_Backend_Token extends Mage_Core_Model_Config_Data
3
+ {
4
+ protected function _afterLoad()
5
+ {
6
+
7
+ $value = $this->getValue();
8
+ if($value ==5) {
9
+ $this->setValue($value);
10
+ } else {
11
+ $this->setValue("");
12
+
13
+ }
14
+
15
+ }
16
+
17
+ protected function _beforeSave()
18
+ {
19
+
20
+
21
+ $value = $this->getValue();
22
+ if($value ==5) {
23
+ $this->setValue($value);
24
+ } else {
25
+ $this->setValue("");
26
+ }
27
+ }
28
+ }
app/code/community/BeezUp/Model/System/Config/Source/Attributes.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
-
3
- class BeezUp_Model_System_Config_Source_Attributes
4
- {
5
-
6
- public function toOptionArray()
7
- {
8
-
9
- $attribute = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId());
10
- $attributeArray = array();
11
-
12
- foreach ($attribute as $option) {
13
- if ($option->getIsUserDefined() && $option->getFrontendLabel()) {
14
- $attributeArray[] = array('value' => $option->getAttributeCode(), 'label' => $option->getAttributeCode());
15
- }
16
- }
17
-
18
- return $attributeArray;
19
- }
20
-
21
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Attributes
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+
9
+ $attribute = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId());
10
+ $attributeArray = array();
11
+
12
+ foreach ($attribute as $option) {
13
+ if ($option->getIsUserDefined() && $option->getFrontendLabel()) {
14
+ $attributeArray[] = array('value' => $option->getAttributeCode(), 'label' => $option->getAttributeCode());
15
+ }
16
+ }
17
+
18
+ return $attributeArray;
19
+ }
20
+
21
  }
app/code/community/BeezUp/Model/System/Config/Source/Availableproducts.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Availableproducts
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ return array(
10
+ array('value' => 1, 'label' => Mage::helper('beezup')->__('Yes')),
11
+ array('value' => 0, 'label' => Mage::helper('beezup')->__('No')),
12
+ );
13
+ }
14
+ }
app/code/community/BeezUp/Model/System/Config/Source/Cache.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
-
3
- class BeezUp_Model_System_Config_Source_Cache
4
- {
5
-
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array('value' => 0, 'label' => Mage::helper('beezup')->__('None')),
10
- array('value' => 30, 'label' => Mage::helper('beezup')->__('30 minutes')),
11
- array('value' => 60, 'label' => Mage::helper('beezup')->__('1 hour')),
12
- array('value' => 120, 'label' => Mage::helper('beezup')->__('2 hours')),
13
- array('value' => 240, 'label' => Mage::helper('beezup')->__('4 hours')),
14
- array('value' => 480, 'label' => Mage::helper('beezup')->__('8 hours')),
15
- array('value' => 720, 'label' => Mage::helper('beezup')->__('12 hours')),
16
- array('value' => 1440, 'label' => Mage::helper('beezup')->__('24 hours')),
17
- );
18
- }
19
- }
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Cache
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 0, 'label' => Mage::helper('beezup')->__('None')),
10
+ array('value' => 30, 'label' => Mage::helper('beezup')->__('30 minutes')),
11
+ array('value' => 60, 'label' => Mage::helper('beezup')->__('1 hour')),
12
+ array('value' => 120, 'label' => Mage::helper('beezup')->__('2 hours')),
13
+ array('value' => 240, 'label' => Mage::helper('beezup')->__('4 hours')),
14
+ array('value' => 480, 'label' => Mage::helper('beezup')->__('8 hours')),
15
+ array('value' => 720, 'label' => Mage::helper('beezup')->__('12 hours')),
16
+ array('value' => 1440, 'label' => Mage::helper('beezup')->__('24 hours')),
17
+ );
18
+ }
19
+ }
app/code/community/BeezUp/Model/System/Config/Source/Debug.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Debug
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 1, 'label' => Mage::helper('beezup')->__('Enable')),
10
+ array('value' => 0, 'label' => Mage::helper('beezup')->__('Disable')),
11
+ );
12
+ }
13
+ }
app/code/community/BeezUp/Model/System/Config/Source/Description.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
-
3
- class BeezUp_Model_System_Config_Source_Description
4
- {
5
-
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array('value' => 'short_description', 'label' => Mage::helper('beezup')->__('Short Description')),
10
- array('value' => 'description', 'label' => Mage::helper('beezup')->__('Description')),
11
- array('value' => 'meta_description', 'label' => Mage::helper('beezup')->__('Meta Description')),
12
- );
13
- }
14
-
15
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Description
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 'short_description', 'label' => Mage::helper('beezup')->__('Short Description')),
10
+ array('value' => 'description', 'label' => Mage::helper('beezup')->__('Description')),
11
+ array('value' => 'meta_description', 'label' => Mage::helper('beezup')->__('Meta Description')),
12
+ );
13
+ }
14
+
15
  }
app/code/community/BeezUp/Model/System/Config/Source/Images.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
-
3
- class BeezUp_Model_System_Config_Source_Images
4
- {
5
-
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array('value' => 1, 'label' => Mage::helper('beezup')->__('Yes')),
10
- array('value' => 0, 'label' => Mage::helper('beezup')->__('No')),
11
- );
12
- }
13
-
14
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Images
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 1, 'label' => Mage::helper('beezup')->__('Yes')),
10
+ array('value' => 0, 'label' => Mage::helper('beezup')->__('No')),
11
+ );
12
+ }
13
+
14
  }
app/code/community/BeezUp/Model/System/Config/Source/Montant.php CHANGED
@@ -1,16 +1,16 @@
1
- <?php
2
-
3
- class BeezUp_Model_System_Config_Source_Montant
4
- {
5
-
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array('value' => "HT", 'label' => Mage::helper('beezup')->__('Excl. Tax - without shipping costs')),
10
- array('value' => "HT_port", 'label' => Mage::helper('beezup')->__('Excl. Tax - with shipping costs')),
11
- array('value' => "TTC", 'label' => Mage::helper('beezup')->__('Incl. Tax - without shipping costs')),
12
- array('value' => "TTC_port", 'label' => Mage::helper('beezup')->__('Incl. Tax - with shipping costs')),
13
- );
14
- }
15
-
16
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Montant
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => "HT", 'label' => Mage::helper('beezup')->__('Excl. Tax - without shipping costs')),
10
+ array('value' => "HT_port", 'label' => Mage::helper('beezup')->__('Excl. Tax - with shipping costs')),
11
+ array('value' => "TTC", 'label' => Mage::helper('beezup')->__('Incl. Tax - without shipping costs')),
12
+ array('value' => "TTC_port", 'label' => Mage::helper('beezup')->__('Incl. Tax - with shipping costs')),
13
+ );
14
+ }
15
+
16
  }
app/code/community/BeezUp/Model/System/Config/Source/Payment.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Payment
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ $payments = Mage::getSingleton('payment/config')->getActiveMethods();
9
+ //$methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('�Please Select�')));
10
+
11
+ foreach ($payments as $paymentCode=>$paymentModel) {
12
+ $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
13
+ $methods[$paymentCode] = array(
14
+ 'label' => $paymentTitle,
15
+ 'value' => $paymentCode,
16
+ );
17
+ }
18
+ return $methods;
19
+ }
20
+
21
+ }
22
+
app/code/community/BeezUp/Model/System/Config/Source/Position.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
-
3
- class BeezUp_Model_System_Config_Source_Position
4
- {
5
-
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array('value' => 'head', 'label' => Mage::helper('beezup')->__('Head')),
10
- array('value' => 'before_body_end', 'label' => Mage::helper('beezup')->__('Before body end')),
11
- );
12
- }
13
-
14
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Position
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 'head', 'label' => Mage::helper('beezup')->__('Head')),
10
+ array('value' => 'before_body_end', 'label' => Mage::helper('beezup')->__('Before body end')),
11
+ );
12
+ }
13
+
14
  }
app/code/community/BeezUp/Model/System/Config/Source/Price.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
-
3
- class BeezUp_Model_System_Config_Source_Price
4
- {
5
-
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array('value' => 1, 'label' => Mage::helper('beezup')->__('Excl. Tax')),
10
- array('value' => 0, 'label' => Mage::helper('beezup')->__('Incl. Tax')),
11
- );
12
- }
13
-
14
  }
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Price
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 1, 'label' => Mage::helper('beezup')->__('Excl. Tax')),
10
+ array('value' => 0, 'label' => Mage::helper('beezup')->__('Incl. Tax')),
11
+ );
12
+ }
13
+
14
  }
app/code/community/BeezUp/Model/System/Config/Source/Shipping.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Shipping
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+
9
+ return $this->getActiveShippingMethods();
10
+
11
+ }
12
+
13
+ public function getActiveShippingMethods()
14
+ {
15
+ $methods = array(array('value'=>'','label'=>Mage::helper('beezup')->__('--Please Select--')));
16
+
17
+ $activeCarriers = Mage::getSingleton('shipping/config')->getActiveCarriers();
18
+ foreach($activeCarriers as $carrierCode => $carrierModel)
19
+ {
20
+ $options = array();
21
+ if( $carrierMethods = $carrierModel->getAllowedMethods() )
22
+ {
23
+ foreach ($carrierMethods as $methodCode => $method)
24
+ {
25
+ $code= $carrierCode.'_'.$methodCode;
26
+ $options[]=array('value'=>$code,'label'=>$method);
27
+
28
+ }
29
+
30
+ $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
31
+
32
+ }
33
+
34
+ $methods[]=array('value'=>$options,'label'=>$carrierTitle);
35
+ }
36
+ return $methods;
37
+ }
38
+
39
+ }
app/code/community/BeezUp/Model/System/Config/Source/Status.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Status
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+
9
+ $orderStatusCollection = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
10
+ $status = array();
11
+ $status = array(
12
+ '-1'=>'Please Select..'
13
+ );
14
+
15
+ foreach($orderStatusCollection as $orderStatus) {
16
+ $status[] = array (
17
+ 'value' => $orderStatus['status'], 'label' => $orderStatus['label']
18
+ );
19
+ }
20
+ return $status;
21
+ }
22
+
23
+ }
app/code/community/BeezUp/Model/System/Config/Source/Userid.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_Model_System_Config_Source_Userid
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+
9
+ return 1;
10
+ }
app/code/community/BeezUp/controllers/CacheController.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezUp_CacheController extends Mage_Core_Controller_Front_Action
4
+ {
5
+
6
+ public function preDispatch()
7
+ {
8
+ parent::preDispatch();
9
+
10
+
11
+ }
12
+
13
+ public function executeAction()
14
+ {
15
+ apc_clear_cache() . "\n"; apc_clear_cache('user') . "\n";
16
+
17
+ apc_clear_cache('opcode') . "\n";
18
+ }
19
+
20
+
21
+ }
app/code/community/BeezUp/controllers/CatalogController.php CHANGED
@@ -1,36 +1,36 @@
1
- <?php
2
-
3
- class BeezUp_CatalogController extends Mage_Core_Controller_Front_Action
4
- {
5
-
6
- public function preDispatch()
7
- {
8
- parent::preDispatch();
9
-
10
- $helper = Mage::helper('beezup');
11
-
12
- $_active = $helper->getConfig('beezup/flux/active');
13
- $_ip = $helper->getConfig('beezup/flux/ip');
14
- $_key = $helper->getConfig('beezup/flux/key');
15
-
16
- if (!$_active || ($_ip && $_ip != $helper->getRemoteAddr()) || ($_key && $this->getRequest()->getParam('key') != $_key)) {
17
- $this->norouteAction();
18
- }
19
- }
20
-
21
- public function xmlAction()
22
- {
23
- $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(false)->toHtml());
24
- }
25
-
26
- public function configurableAction()
27
- {
28
- $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(true)->setChildXML(false)->toHtml());
29
- }
30
-
31
- public function childAction()
32
- {
33
- $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(true)->toHtml());
34
- }
35
-
36
  }
1
+ <?php
2
+
3
+ class BeezUp_CatalogController extends Mage_Core_Controller_Front_Action
4
+ {
5
+
6
+ public function preDispatch()
7
+ {
8
+ parent::preDispatch();
9
+
10
+ $helper = Mage::helper('beezup');
11
+
12
+ $_active = $helper->getConfig('beezup/flux/active');
13
+ $_ip = $helper->getConfig('beezup/flux/ip');
14
+ $_key = $helper->getConfig('beezup/flux/key');
15
+
16
+ if (!$_active || ($_ip && $_ip != $helper->getRemoteAddr()) || ($_key && $this->getRequest()->getParam('key') != $_key)) {
17
+ $this->norouteAction();
18
+ }
19
+ }
20
+
21
+ public function xmlAction()
22
+ {
23
+ $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(false)->toHtml());
24
+ }
25
+
26
+ public function configurableAction()
27
+ {
28
+ $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(true)->setChildXML(false)->toHtml());
29
+ }
30
+
31
+ public function childAction()
32
+ {
33
+ $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/xml')->setConfigurable(false)->setChildXML(true)->toHtml());
34
+ }
35
+
36
  }
app/code/community/BeezUp/controllers/CronController.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once dirname ( __FILE__ ) . "/../lib/bootstrap.php";
3
+ require_once dirname ( __FILE__ ) . "/../lib/BeezupRepository.php";
4
+ class BeezUp_CronController extends Mage_Core_Controller_Front_Action
5
+ {
6
+
7
+ public function preDispatch()
8
+ {
9
+ parent::preDispatch();
10
+
11
+ $repository = new BeezupRepository();
12
+ if(!$repository->isConnectionOk()) {
13
+ $this->norouteAction();
14
+ }
15
+ }
16
+
17
+ public function executeAction()
18
+ {
19
+ $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/order')->executeCron());
20
+ }
21
+
22
+
23
+ }
app/code/community/BeezUp/controllers/LogController.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class BeezUp_LogController extends Mage_Core_Controller_Front_Action
5
+ {
6
+
7
+ public function preDispatch()
8
+ {
9
+ parent::preDispatch();
10
+
11
+ }
12
+
13
+ public function loadAction()
14
+ {
15
+ $this->getResponse()->setBody($this->getLayout()->createBlock('beezup/order')->getLog());
16
+ }
17
+
18
+
19
+ }
app/code/community/BeezUp/controllers/Sales/OrderController.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $defController = Mage::getBaseDir()
4
+ . DS . 'app' . DS . 'code' . DS . 'core'
5
+ . DS . 'Mage' . DS . 'Adminhtml' . DS . 'controllers'
6
+ . DS . 'Sales' . DS . 'OrderController.php';
7
+
8
+
9
+
10
+ require_once $defController;
11
+
12
+ /**
13
+ * Adminhtml sales(123) orders controller
14
+ *
15
+ * @author Inchoo <ivan.galambos@inchoo.net>
16
+ */
17
+ class BeezUp_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
18
+ {
19
+
20
+
21
+ /**
22
+ * Orders grid
23
+ */
24
+ public function indexAction()
25
+ {
26
+
27
+ if ($this->getRequest()->getParam('prepared') === 'beezup') {
28
+
29
+ /* Mage::getSingleton('adminhtml/session')->addSuccess($this->__('You are viewing a) case of order grid.'));
30
+
31
+ $this->_title($this->__('Sales'))->_title($this->__('Orders'));
32
+
33
+ $from = date("Y-m-d", strtotime('-120 day'));
34
+ $to = date("Y-m-d", strtotime('-1 day'));
35
+ $locale = Mage::app()->getLocale()->getLocaleCode();
36
+
37
+ Mage::register('preparedFilter', array(
38
+ 'store_id' => '1',
39
+ 'status' => 'processing',
40
+ 'created_at' => array(
41
+ 'from'=> new Zend_Date($from, null, $locale),
42
+ 'to'=> new Zend_Date($to, null, $locale),
43
+ 'locale' => $locale,
44
+ 'orig_to' => Mage::helper('core')->formatDate($to),
45
+ 'orig_from' => Mage::helper('core')->formatDate($from),
46
+ 'datetime' => true
47
+ )
48
+ ));*/
49
+
50
+
51
+
52
+ // Mage::getSingleton('adminhtml/session')->addSuccess($this->__('You are viewing Beezup sales order grid.'));
53
+
54
+ $this->_title($this->__('Sales'))->_title($this->__('Beezup Orders'));
55
+
56
+
57
+
58
+ }
59
+ else {
60
+
61
+ // Mage::getSingleton('adminhtml/session')->addSuccess($this->__('You are viewing default sales order grid.'));
62
+
63
+ $this->_title($this->__('Sales'))->_title($this->__('Orders'));
64
+
65
+ }
66
+ $this->_initAction()->renderLayout();
67
+ }
68
+ }
app/code/community/BeezUp/etc/adminhtml.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <sales translate="title" module="beezup">
5
+ <title>Sales</title>
6
+ <sort_order>20</sort_order>
7
+ <depends>
8
+ <module>Mage_Sales</module>
9
+ </depends>
10
+ <children>
11
+ <order translate="title" module="beezup">
12
+ <title>Orders</title>
13
+ <action>adminhtml/sales_order</action>
14
+ <sort_order>10</sort_order>
15
+ <children>
16
+ <order_default>
17
+ <title>Orders</title>
18
+ <action>adminhtml/sales_order</action>
19
+ <sort_order>10</sort_order>
20
+ </order_default>
21
+ <order_a>
22
+ <title>BeezUP Orders</title>
23
+ <action>adminhtml/sales_order/index/prepared/beezup</action>
24
+ <sort_order>20</sort_order>
25
+ </order_a>
26
+
27
+ </children>
28
+ </order>
29
+ </children>
30
+ </sales>
31
+ </menu>
32
+ <acl>
33
+ <resources>
34
+ <admin>
35
+ <children>
36
+ <sales translate="title" module="beezup">
37
+ <title>Sales</title>
38
+ <children>
39
+ <order translate="title" module="beezup">
40
+ <title>Orders</title>
41
+ <sort_order>10</sort_order>
42
+ <children>
43
+ <order_default>
44
+ <title>OOrders</title>
45
+ <sort_order>10</sort_order>
46
+ </order_default>
47
+ <order_a>
48
+ <title>Beezup Orders</title>
49
+ <sort_order>20</sort_order>
50
+ </order_a>
51
+
52
+ </children>
53
+ </order>
54
+ </children>
55
+ </sales>
56
+ </children>
57
+ </admin>
58
+ </resources>
59
+ </acl>
60
+ </config>
app/code/community/BeezUp/etc/config.xml CHANGED
@@ -1,124 +1,199 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <BeezUp>
5
- <version>3.2.0</version>
6
- </BeezUp>
7
- </modules>
8
- <global>
9
- <blocks>
10
- <beezup>
11
- <class>BeezUp_Block</class>
12
- </beezup>
13
- </blocks>
14
- <models>
15
- <beezup>
16
- <class>BeezUp_Model</class>
17
- </beezup>
18
- </models>
19
- <helpers>
20
- <beezup>
21
- <class>BeezUp_Helper</class>
22
- </beezup>
23
- </helpers>
24
- </global>
25
- <frontend>
26
- <routers>
27
- <beezup>
28
- <use>standard</use>
29
- <args>
30
- <module>BeezUp</module>
31
- <frontName>beezup</frontName>
32
- </args>
33
- </beezup>
34
- </routers>
35
- <events>
36
- <controller_action_layout_generate_blocks_before>
37
- <observers>
38
- <beezup_visitors_tracking>
39
- <type>singleton</type>
40
- <class>beezup/observer</class>
41
- <method>addBlockTracking</method>
42
- </beezup_visitors_tracking>
43
- </observers>
44
- </controller_action_layout_generate_blocks_before>
45
- <checkout_onepage_controller_success_action>
46
- <observers>
47
- <beezup_sales_tracking>
48
- <type>singleton</type>
49
- <class>beezup/observer</class>
50
- <method>addOrder</method>
51
- </beezup_sales_tracking>
52
- </observers>
53
- </checkout_onepage_controller_success_action>
54
- </events>
55
- <translate>
56
- <modules>
57
- <BeezUp>
58
- <files>
59
- <default>BeezUp.csv</default>
60
- </files>
61
- </BeezUp>
62
- </modules>
63
- </translate>
64
- </frontend>
65
- <adminhtml>
66
- <acl>
67
- <resources>
68
- <admin>
69
- <children>
70
- <system>
71
- <children>
72
- <config>
73
- <children>
74
- <beezup>
75
- <title>BeezUP</title>
76
- </beezup>
77
- </children>
78
- </config>
79
- </children>
80
- </system>
81
- </children>
82
- </admin>
83
- </resources>
84
- </acl>
85
- <translate>
86
- <modules>
87
- <BeezUp>
88
- <files>
89
- <default>BeezUp.csv</default>
90
- </files>
91
- </BeezUp>
92
- </modules>
93
- </translate>
94
- </adminhtml>
95
- <default>
96
- <beezup>
97
- <tracking>
98
- <active>0</active>
99
- <storeid></storeid>
100
- <marge>0</marge>
101
- <debug>0</debug>
102
- <montant>HT</montant>
103
- <position>head</position>
104
- </tracking>
105
- <flux>
106
- <active>0</active>
107
- <debug_flux>1</debug_flux>
108
- <ht>1</ht>
109
- <vat>19.6</vat>
110
- <tablerates_weight_destination>0</tablerates_weight_destination>
111
- <days_in>1-2</days_in>
112
- <days_out>6-8</days_out>
113
- <description>short_description</description>
114
- <catalog_rules>0</catalog_rules>
115
- <bom>1</bom>
116
- <cachedelay>2</cachedelay>
117
- <ship></ship>
118
- <key></key>
119
- <ip></ip>
120
- <images></images>
121
- </flux>
122
- </beezup>
123
- </default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <BeezUp>
5
+ <version>4.0.0</version>
6
+ </BeezUp>
7
+ </modules>
8
+ <global>
9
+
10
+
11
+ <resources>
12
+ <beezup_setup>
13
+ <setup>
14
+ <module>BeezUp</module>
15
+ <class>Mage_Eav_Model_Entity_Setup </class>
16
+ </setup>
17
+ <connection>
18
+ <use>core_setup</use>
19
+ </connection>
20
+ </beezup_setup>
21
+
22
+ </resources>
23
+
24
+ <blocks>
25
+
26
+
27
+ <beezup>
28
+ <class>BeezUp_Block</class>
29
+ </beezup>
30
+
31
+ <adminhtml>
32
+ <rewrite>
33
+ <sales_order_grid>BeezUp_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
34
+ <sales_order_totals>BeezUp_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
35
+ <sales_order_invoice_totals>BeezUp_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
36
+ <sales_order_creditmemo_totals>BeezUp_Block_Adminhtml_Sales_Order_Creditmemo_Totals</sales_order_creditmemo_totals>
37
+
38
+
39
+ </rewrite>
40
+ </adminhtml>
41
+
42
+ </blocks>
43
+ <models>
44
+ <sales>
45
+ <rewrite>
46
+ <order_pdf_invoice>BeezUp_Model_Sales_Order_Pdf_Invoice</order_pdf_invoice>
47
+ </rewrite>
48
+ </sales>
49
+ <shipping>
50
+ <rewrite>
51
+ <carrier_flatrate>BeezUp_Model_Flatrate</carrier_flatrate>
52
+ </rewrite>
53
+ </shipping>
54
+
55
+ <beezup>
56
+ <class>BeezUp_Model</class>
57
+ </beezup>
58
+ </models>
59
+ <helpers>
60
+ <beezup>
61
+ <class>BeezUp_Helper</class>
62
+ </beezup>
63
+ </helpers>
64
+ </global>
65
+
66
+
67
+
68
+
69
+ <frontend>
70
+ <routers>
71
+ <beezup>
72
+ <use>standard</use>
73
+ <args>
74
+ <module>BeezUp</module>
75
+ <frontName>beezup</frontName>
76
+ </args>
77
+ </beezup>
78
+ </routers>
79
+ <events>
80
+ <controller_action_layout_generate_blocks_before>
81
+ <observers>
82
+ <beezup_visitors_tracking>
83
+ <type>singleton</type>
84
+ <class>beezup/observer</class>
85
+ <method>addBlockTracking</method>
86
+ </beezup_visitors_tracking>
87
+ </observers>
88
+ </controller_action_layout_generate_blocks_before>
89
+ <checkout_onepage_controller_success_action>
90
+ <observers>
91
+ <beezup_sales_tracking>
92
+ <type>singleton</type>
93
+ <class>beezup/observer</class>
94
+ <method>addOrder</method>
95
+ </beezup_sales_tracking>
96
+ </observers>
97
+ </checkout_onepage_controller_success_action>
98
+ </events>
99
+ <translate>
100
+ <modules>
101
+ <BeezUp>
102
+ <files>
103
+ <default>BeezUp.csv</default>
104
+ </files>
105
+ </BeezUp>
106
+ </modules>
107
+ </translate>
108
+ </frontend>
109
+ <adminhtml>
110
+ <layout>
111
+ <updates>
112
+ <beezup>
113
+ <file>beezup_salestab.xml</file>
114
+ </beezup>
115
+ </updates>
116
+ </layout>
117
+ <acl>
118
+ <resources>
119
+
120
+
121
+ <admin>
122
+ <children>
123
+ <system>
124
+ <children>
125
+ <config>
126
+ <children>
127
+ <beezup>
128
+ <title>BeezUP</title>
129
+ </beezup>
130
+ </children>
131
+ </config>
132
+ </children>
133
+ </system>
134
+ </children>
135
+ </admin>
136
+ </resources>
137
+ </acl>
138
+ <translate>
139
+ <modules>
140
+ <BeezUp>
141
+ <files>
142
+ <default>BeezUp.csv</default>
143
+ </files>
144
+ </BeezUp>
145
+ </modules>
146
+ </translate>
147
+ </adminhtml>
148
+ <default>
149
+
150
+ <beezup>
151
+
152
+ <tracking>
153
+ <active>0</active>
154
+ <storeid></storeid>
155
+ <marge>0</marge>
156
+ <debug>0</debug>
157
+ <montant>HT</montant>
158
+ <position>head</position>
159
+ </tracking>
160
+ <marketplace>
161
+ <connection_status>0</connection_status>
162
+ </marketplace>
163
+ <flux>
164
+ <active>0</active>
165
+ <debug_flux>1</debug_flux>
166
+ <ht>1</ht>
167
+ <vat>19.6</vat>
168
+ <tablerates_weight_destination>0</tablerates_weight_destination>
169
+ <days_in>1-2</days_in>
170
+ <days_out>6-8</days_out>
171
+ <description>short_description</description>
172
+ <catalog_rules>0</catalog_rules>
173
+ <bom>1</bom>
174
+ <cachedelay>2</cachedelay>
175
+ <ship></ship>
176
+ <key></key>
177
+ <ip></ip>
178
+ <images></images>
179
+ </flux>
180
+ </beezup>
181
+ </default>
182
+
183
+
184
+ <admin>
185
+ <routers>
186
+ <adminhtml>
187
+ <use>admin</use>
188
+ <args>
189
+ <modules>
190
+ <BeezUp before="Mage_Adminhtml">BeezUp</BeezUp>
191
+ </modules>
192
+ </args>
193
+ </adminhtml>
194
+ </routers>
195
+ </admin>
196
+
197
+
198
+
199
  </config>
app/code/community/BeezUp/etc/system.xml CHANGED
@@ -1,245 +1,574 @@
1
- <config>
2
- <sections>
3
- <beezup translate="label" module="beezup">
4
- <label>BeezUP</label>
5
- <tab>catalog</tab>
6
- <sort_order>900</sort_order>
7
- <show_in_default>1</show_in_default>
8
- <show_in_website>1</show_in_website>
9
- <show_in_store>1</show_in_store>
10
- <groups>
11
- <tracking translate="label">
12
- <label>Tracking</label>
13
- <frontend_type>text</frontend_type>
14
- <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v3.1.3) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
15
- <sort_order>1</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- <fields>
20
- <active translate="label">
21
- <label>Enabled</label>
22
- <frontend_type>select</frontend_type>
23
- <source_model>adminhtml/system_config_source_yesno</source_model>
24
- <sort_order>1</sort_order>
25
- <show_in_default>1</show_in_default>
26
- <show_in_website>1</show_in_website>
27
- <show_in_store>1</show_in_store>
28
- </active>
29
- <storeid translate="label">
30
- <label>Store ID</label>
31
- <frontend_type>text</frontend_type>
32
- <comment><![CDATA[Get your Store ID from My trackers page in your BeezUP account]]></comment>
33
- <sort_order>2</sort_order>
34
- <show_in_default>1</show_in_default>
35
- <show_in_website>1</show_in_website>
36
- <show_in_store>1</show_in_store>
37
- </storeid>
38
- <marge translate="label">
39
- <label>Calculate product margin</label>
40
- <frontend_type>select</frontend_type>
41
- <source_model>adminhtml/system_config_source_yesno</source_model>
42
- <comment><![CDATA[The field cost must be indicated for all products]]></comment>
43
- <sort_order>3</sort_order>
44
- <show_in_default>1</show_in_default>
45
- <show_in_website>1</show_in_website>
46
- <show_in_store>1</show_in_store>
47
- </marge>
48
- <montant translate="label">
49
- <label>Total orders amount</label>
50
- <frontend_type>select</frontend_type>
51
- <source_model>beezup/system_config_source_montant</source_model>
52
- <sort_order>4</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
- <show_in_store>1</show_in_store>
56
- </montant>
57
- <debug translate="label">
58
- <label>Logs</label>
59
- <frontend_type>select</frontend_type>
60
- <source_model>adminhtml/system_config_source_yesno</source_model>
61
- <comment><![CDATA[Enable tracker logs (var/log/beezup.log)]]></comment>
62
- <sort_order>5</sort_order>
63
- <show_in_default>1</show_in_default>
64
- <show_in_website>1</show_in_website>
65
- <show_in_store>1</show_in_store>
66
- </debug>
67
- </fields>
68
- </tracking>
69
- </groups>
70
- <groups>
71
- <flux translate="label">
72
- <label>Catalog Flow</label>
73
- <frontend_type>text</frontend_type>
74
- <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v3.1.3) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
75
- <sort_order>2</sort_order>
76
- <show_in_default>1</show_in_default>
77
- <show_in_website>1</show_in_website>
78
- <show_in_store>1</show_in_store>
79
- <fields>
80
- <active translate="label">
81
- <label>Enabled</label>
82
- <comment><![CDATA[www.yoursite.com/beezup/catalog/xml<br />www.yoursite.com/beezup/catalog/configurable <br /> www.yoursite.com/beezup/catalog/child]]></comment>
83
- <frontend_type>select</frontend_type>
84
- <source_model>adminhtml/system_config_source_yesno</source_model>
85
- <sort_order>1</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
- </active>
90
- <debug_flux translate="label">
91
- <label>Debug Mode</label>
92
- <comment><![CDATA[Limit the number of products]]></comment>
93
- <frontend_type>select</frontend_type>
94
- <source_model>adminhtml/system_config_source_yesno</source_model>
95
- <sort_order>2</sort_order>
96
- <show_in_default>1</show_in_default>
97
- <show_in_website>1</show_in_website>
98
- <show_in_store>1</show_in_store>
99
- </debug_flux>
100
- <stock translate="label">
101
- <label>Filter out of stock products</label>
102
- <frontend_type>select</frontend_type>
103
- <source_model>adminhtml/system_config_source_yesno</source_model>
104
- <sort_order>3</sort_order>
105
- <show_in_default>1</show_in_default>
106
- <show_in_website>1</show_in_website>
107
- <show_in_store>1</show_in_store>
108
- </stock>
109
- <ship translate="label">
110
- <label>Shipping (Incl. Tax)</label>
111
- <frontend_type>text</frontend_type>
112
- <sort_order>4</sort_order>
113
- <show_in_default>1</show_in_default>
114
- <show_in_website>1</show_in_website>
115
- <show_in_store>1</show_in_store>
116
- </ship>
117
- <tablerates_weight_destination translate="label">
118
- <label>Table Rates</label>
119
- <comment><![CDATA[Use Table Rates (only Weight vs. Destination)]]></comment>
120
- <frontend_type>select</frontend_type>
121
- <source_model>adminhtml/system_config_source_yesno</source_model>
122
- <sort_order>5</sort_order>
123
- <show_in_default>1</show_in_default>
124
- <show_in_website>1</show_in_website>
125
- <show_in_store>1</show_in_store>
126
- </tablerates_weight_destination>
127
- <ht translate="label">
128
- <label>Catalog Price</label>
129
- <frontend_type>select</frontend_type>
130
- <source_model>beezup/system_config_source_price</source_model>
131
- <comment><![CDATA[Product Price Excl. Tax or Incl. Tax in catalog]]></comment>
132
- <sort_order>6</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
- </ht>
137
- <vat translate="label">
138
- <label>VAT Rates</label>
139
- <frontend_type>text</frontend_type>
140
- <sort_order>7</sort_order>
141
- <show_in_default>1</show_in_default>
142
- <show_in_website>1</show_in_website>
143
- <show_in_store>1</show_in_store>
144
- </vat>
145
- <catalog_rules translate="label">
146
- <label>Use Catalog Price Rules</label>
147
- <comment><![CDATA[Let off if Catalog Price Rules are not used]]></comment>
148
- <frontend_type>select</frontend_type>
149
- <source_model>adminhtml/system_config_source_yesno</source_model>
150
- <sort_order>8</sort_order>
151
- <show_in_default>1</show_in_default>
152
- <show_in_website>1</show_in_website>
153
- <show_in_store>1</show_in_store>
154
- </catalog_rules>
155
- <days_in translate="label">
156
- <label>Delivery Time if Product in Stock</label>
157
- <frontend_type>text</frontend_type>
158
- <comment><![CDATA[Enter eg 1-2 for 1 to 2 days]]></comment>
159
- <sort_order>9</sort_order>
160
- <show_in_default>1</show_in_default>
161
- <show_in_website>1</show_in_website>
162
- <show_in_store>1</show_in_store>
163
- </days_in>
164
- <days_out translate="label">
165
- <label>Delivery Time if Product out of Stock</label>
166
- <frontend_type>text</frontend_type>
167
- <comment><![CDATA[Enter eg 6-8 for 6 to 8 days]]></comment>
168
- <sort_order>10</sort_order>
169
- <show_in_default>1</show_in_default>
170
- <show_in_website>1</show_in_website>
171
- <show_in_store>1</show_in_store>
172
- </days_out>
173
- <description translate="label">
174
- <label>Product description</label>
175
- <frontend_type>select</frontend_type>
176
- <source_model>beezup/system_config_source_description</source_model>
177
- <sort_order>11</sort_order>
178
- <show_in_default>1</show_in_default>
179
- <show_in_website>1</show_in_website>
180
- <show_in_store>1</show_in_store>
181
- </description>
182
- <attributes translate="label">
183
- <label>Specific Attributes</label>
184
- <frontend_type>multiselect</frontend_type>
185
- <source_model>beezup/system_config_source_attributes</source_model>
186
- <sort_order>12</sort_order>
187
- <show_in_default>1</show_in_default>
188
- <show_in_website>1</show_in_website>
189
- <show_in_store>1</show_in_store>
190
- </attributes>
191
- <ip translate="label">
192
- <label>BeezUP Server IP address</label>
193
- <comment><![CDATA[Only this IP address will be able to read the flow (leave empty to disable the restriction)]]></comment>
194
- <frontend_type>text</frontend_type>
195
- <sort_order>13</sort_order>
196
- <show_in_default>1</show_in_default>
197
- <show_in_website>1</show_in_website>
198
- <show_in_store>1</show_in_store>
199
- </ip>
200
- <key translate="label">
201
- <label>Key</label>
202
- <frontend_type>text</frontend_type>
203
- <comment><![CDATA[Protects the flow by a unique key (Eg: 85ds6f7): www.yoursite.com/beezup/catalog/xml/key/85ds6f7/]]></comment>
204
- <sort_order>14</sort_order>
205
- <show_in_default>1</show_in_default>
206
- <show_in_website>1</show_in_website>
207
- <show_in_store>1</show_in_store>
208
- </key>
209
- <bom translate="label">
210
- <label>Bom</label>
211
- <frontend_type>select</frontend_type>
212
- <source_model>adminhtml/system_config_source_yesno</source_model>
213
- <comment><![CDATA[Add Byte Order Mark (BOM)]]></comment>
214
- <sort_order>15</sort_order>
215
- <show_in_default>1</show_in_default>
216
- <show_in_website>1</show_in_website>
217
- <show_in_store>1</show_in_store>
218
- </bom>
219
- <cachedelay translate="label">
220
- <label>Cache delay</label>
221
- <frontend_type>select</frontend_type>
222
- <source_model>beezup/system_config_source_cache</source_model>
223
- <comment><![CDATA[Refresh time of the cache export file in hours]]></comment>
224
- <sort_order>16</sort_order>
225
- <show_in_default>1</show_in_default>
226
- <show_in_website>1</show_in_website>
227
- <show_in_store>1</show_in_store>
228
- </cachedelay>
229
- <images translate="label">
230
- <label>Export all available pictures</label>
231
- <frontend_type>select</frontend_type>
232
- <source_model>beezup/system_config_source_images</source_model>
233
- <comment><![CDATA[Export all available pictures]]></comment>
234
- <sort_order>17</sort_order>
235
- <show_in_default>1</show_in_default>
236
- <show_in_website>1</show_in_website>
237
- <show_in_store>1</show_in_store>
238
- </images>
239
-
240
- </fields>
241
- </flux>
242
- </groups>
243
- </beezup>
244
- </sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  </config>
1
+ <config>
2
+ <sections>
3
+
4
+
5
+ <beezup translate="label" module="beezup">
6
+ <label>BeezUP</label>
7
+ <tab>catalog</tab>
8
+ <sort_order>900</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <tracking translate="label">
14
+ <label>Tracking</label>
15
+ <frontend_type>text</frontend_type>
16
+ <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.0.0) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <fields>
22
+ <active translate="label">
23
+ <label>Enabled</label>
24
+ <frontend_type>select</frontend_type>
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <sort_order>1</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </active>
31
+ <storeid translate="label">
32
+ <label>Store ID</label>
33
+ <frontend_type>text</frontend_type>
34
+ <comment><![CDATA[Get your Store ID from My trackers page in your BeezUP account]]></comment>
35
+ <sort_order>2</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </storeid>
40
+ <marge translate="label">
41
+ <label>Calculate product margin</label>
42
+ <frontend_type>select</frontend_type>
43
+ <source_model>adminhtml/system_config_source_yesno</source_model>
44
+ <comment><![CDATA[The field cost must be indicated for all products]]></comment>
45
+ <sort_order>3</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </marge>
50
+ <montant translate="label">
51
+ <label>Total orders amount</label>
52
+ <frontend_type>select</frontend_type>
53
+ <source_model>beezup/system_config_source_montant</source_model>
54
+ <sort_order>4</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </montant>
59
+ <debug translate="label">
60
+ <label>Logs</label>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>adminhtml/system_config_source_yesno</source_model>
63
+ <comment><![CDATA[Enable tracker logs (var/log/beezup.log)]]></comment>
64
+ <sort_order>5</sort_order>
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
+ </debug>
69
+ </fields>
70
+ </tracking>
71
+ </groups>
72
+
73
+
74
+
75
+
76
+ <groups>
77
+ <marketplace tanslate="label">
78
+ <label>Marketplace</label>
79
+ <frontend_type>text</frontend_type>
80
+ <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.0.0) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
81
+ <sort_order>2</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ <fields>
86
+
87
+ <api_credentials translate="comment">
88
+ <label>BeezUP API Credentials:</label>
89
+ <frontend_model>beezup/adminhtml_system_config_childgroup</frontend_model>
90
+ <sort_order>0</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </api_credentials>
95
+
96
+ <connection_status translate="label">
97
+ <label>API BeezUP Connection status:</label>
98
+ <frontend_type>text</frontend_type>
99
+ <frontend_model>beezup/adminhtml_system_config_credentials</frontend_model>
100
+ <backend_model>beezup/system_config_backend_credentials</backend_model>
101
+ <sort_order>1</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ </connection_status>
106
+
107
+ <sync_status translate="label">
108
+ <label>Sync Status:</label>
109
+ <frontend_type>text</frontend_type>
110
+ <frontend_model>beezup/adminhtml_system_config_syncstatus</frontend_model>
111
+ <sort_order>2</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </sync_status>
116
+
117
+
118
+ <syncro_time translate="label">
119
+ <label>Last synchronization time :</label>
120
+ <frontend_type>text</frontend_type>
121
+ <frontend_model>beezup/adminhtml_system_config_time</frontend_model>
122
+ <backend_model>beezup/system_config_backend_time</backend_model>
123
+ <sort_order>3</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </syncro_time>
128
+
129
+
130
+ <cron_url translate="label">
131
+ <label>Manual orders retrieval link:</label>
132
+ <frontend_type>text</frontend_type>
133
+ <frontend_model>beezup/adminhtml_system_config_manualcron</frontend_model>
134
+
135
+ <sort_order>4</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
+ <depends><connection_status>1</connection_status></depends>
140
+ </cron_url>
141
+
142
+ <cron_call translate="label">
143
+ <label>Cron Call</label>
144
+ <frontend_type>text</frontend_type>
145
+ <frontend_model>beezup/adminhtml_system_config_cron</frontend_model>
146
+
147
+ <sort_order>5</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ <depends><connection_status>1</connection_status></depends>
152
+ </cron_call>
153
+
154
+
155
+ <userid translate="label">
156
+ <label>User Id</label>
157
+ <frontend_type>text</frontend_type>
158
+ <comment><![CDATA[<a href='https://go.beezup.com/Account/MyAccount' target='_blank'>My Account</a>]]></comment>
159
+ <sort_order>6</sort_order>
160
+ <show_in_default>1</show_in_default>
161
+ <show_in_website>1</show_in_website>
162
+ <show_in_store>1</show_in_store>
163
+ </userid>
164
+ <usertoken translate="label">
165
+ <label>User Token</label>
166
+ <frontend_type>text</frontend_type>
167
+ <comment><![CDATA[<a href='https://go.beezup.com/Account/MyAccount' target='_blank'>My Account</a>]]></comment>
168
+ <sort_order>7</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </usertoken>
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <status_mapping translate="comment">
180
+ <label>BeezUP API Status mapping :</label>
181
+ <frontend_model>beezup/adminhtml_system_config_childgroup</frontend_model>
182
+ <sort_order>16</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ </status_mapping>
187
+
188
+
189
+ <status_new translate="comment">
190
+ <label>New (New) </label>
191
+ <frontend_type>select</frontend_type>
192
+ <source_model>beezup/system_config_source_status</source_model>
193
+ <sort_order>17</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ <comment></comment>
198
+
199
+ </status_new>
200
+
201
+
202
+ <status_progress translate="comment">
203
+ <label>In progress (InProgress)</label>
204
+ <frontend_type>select</frontend_type>
205
+ <source_model>beezup/system_config_source_status</source_model>
206
+ <sort_order>18</sort_order>
207
+ <show_in_default>1</show_in_default>
208
+ <show_in_website>1</show_in_website>
209
+ <show_in_store>1</show_in_store>
210
+ <comment></comment>
211
+
212
+ </status_progress>
213
+
214
+
215
+ <status_cancelled translate="comment">
216
+ <label>Cancelled (Canceled)</label>
217
+ <frontend_type>select</frontend_type>
218
+ <source_model>beezup/system_config_source_status</source_model>
219
+ <sort_order>19</sort_order>
220
+ <show_in_default>1</show_in_default>
221
+ <show_in_website>1</show_in_website>
222
+ <show_in_store>1</show_in_store>
223
+ <comment></comment>
224
+
225
+ </status_cancelled>
226
+
227
+ <status_shipped translate="comment">
228
+ <label>Shipped (Shipped)</label>
229
+ <frontend_type>select</frontend_type>
230
+ <source_model>beezup/system_config_source_status</source_model>
231
+ <sort_order>19</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>1</show_in_store>
235
+ <comment></comment>
236
+
237
+ </status_shipped>
238
+
239
+ <status_closed translate="comment">
240
+ <label>Closed (Closed)</label>
241
+ <frontend_type>select</frontend_type>
242
+ <source_model>beezup/system_config_source_status</source_model>
243
+ <sort_order>19</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ <comment></comment>
248
+
249
+ </status_closed>
250
+
251
+
252
+ <status_aborted translate="comment">
253
+ <label>(Aborted)</label>
254
+ <frontend_type>select</frontend_type>
255
+ <source_model>beezup/system_config_source_status</source_model>
256
+ <sort_order>19</sort_order>
257
+ <show_in_default>1</show_in_default>
258
+ <show_in_website>1</show_in_website>
259
+ <show_in_store>1</show_in_store>
260
+ <comment></comment>
261
+
262
+ </status_aborted>
263
+
264
+
265
+
266
+
267
+ <stores_mapping translate="comment">
268
+ <label>BeezUP Stores mapping :</label>
269
+ <frontend_model>beezup/adminhtml_system_config_childgroup</frontend_model>
270
+ <sort_order>26</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>1</show_in_store>
274
+ </stores_mapping>
275
+
276
+
277
+ <stores translate="comment">
278
+ <label>BeezUP Stores mapping :</label>
279
+ <frontend_model>beezup/adminhtml_system_config_stores</frontend_model>
280
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
281
+ <sort_order>27</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ <comment></comment>
286
+
287
+ </stores>
288
+
289
+
290
+ <field_mapping translate="comment">
291
+ <label>BeezUP id field mapping :</label>
292
+ <frontend_model>beezup/adminhtml_system_config_childgroup</frontend_model>
293
+ <sort_order>28</sort_order>
294
+ <show_in_default>1</show_in_default>
295
+ <show_in_website>1</show_in_website>
296
+ <show_in_store>1</show_in_store>
297
+ </field_mapping>
298
+
299
+ <attributes translate="comment">
300
+ <label>BeezUP id field mapping</label>
301
+ <frontend_model>beezup/adminhtml_system_config_attributes</frontend_model>
302
+ <backend_model>beezup/system_config_backend_attributes</backend_model>
303
+ <sort_order>29</sort_order>
304
+ <show_in_default>1</show_in_default>
305
+ <show_in_website>1</show_in_website>
306
+ <show_in_store>1</show_in_store>
307
+ <comment></comment>
308
+
309
+ </attributes>
310
+
311
+
312
+
313
+ <main_config_block translate="comment">
314
+ <label>BeezUP Config:</label>
315
+ <frontend_model>beezup/adminhtml_system_config_childgroup</frontend_model>
316
+ <sort_order>30</sort_order>
317
+ <show_in_default>1</show_in_default>
318
+ <show_in_website>1</show_in_website>
319
+ <show_in_store>1</show_in_store>
320
+ </main_config_block>
321
+
322
+
323
+
324
+ <payment_method translate="label">
325
+ <label>Default payment </label>
326
+ <frontend_type>select</frontend_type>
327
+ <source_model>beezup/system_config_source_payment</source_model>
328
+ <sort_order>32</sort_order>
329
+ <show_in_default>1</show_in_default>
330
+ <show_in_website>1</show_in_website>
331
+ <show_in_store>1</show_in_store>
332
+ </payment_method>
333
+
334
+
335
+
336
+ <available_products translate="label">
337
+ <label>Allow creating orders with non available products (Beta Version)</label>
338
+ <frontend_type>select</frontend_type>
339
+ <source_model>beezup/system_config_source_availableproducts</source_model>
340
+ <sort_order>33</sort_order>
341
+ <show_in_default>1</show_in_default>
342
+ <show_in_website>1</show_in_website>
343
+ <show_in_store>1</show_in_store>
344
+ </available_products>
345
+
346
+
347
+ <debug_mode translate="label">
348
+ <label>Debug Mode</label>
349
+ <frontend_type>select</frontend_type>
350
+ <comment>Set enabled to display error repporting (should be desabled in production shop)</comment>
351
+ <source_model>beezup/system_config_source_debug</source_model>
352
+ <comment><![CDATA[Create products if not matched - should always be disabled in production shop]]></comment>
353
+ <sort_order>34</sort_order>
354
+ <show_in_default>1</show_in_default>
355
+ <show_in_website>1</show_in_website>
356
+ <show_in_store>1</show_in_store>
357
+ </debug_mode>
358
+
359
+
360
+ <log_block translate="comment">
361
+ <label>Last execution Logs:</label>
362
+ <frontend_model>beezup/adminhtml_system_config_childgroup</frontend_model>
363
+ <sort_order>35</sort_order>
364
+ <show_in_default>1</show_in_default>
365
+ <show_in_website>1</show_in_website>
366
+ <show_in_store>1</show_in_store>
367
+ </log_block>
368
+
369
+
370
+ <log translate="comment">
371
+ <label></label>
372
+ <frontend_model>beezup/adminhtml_system_config_log</frontend_model>
373
+ <sort_order>36</sort_order>
374
+ <show_in_default>1</show_in_default>
375
+ <show_in_website>1</show_in_website>
376
+ <show_in_store>1</show_in_store>
377
+ </log>
378
+
379
+ </fields>
380
+ </marketplace>
381
+ </groups>
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+ <groups>
400
+ <flux translate="label">
401
+ <label>Catalog Flow</label>
402
+ <frontend_type>text</frontend_type>
403
+ <comment><![CDATA[<div style="font-size:11px;padding:3px;margin-bottom:20px;background:#FFF9E9;border:1px solid #EEE2BE">Support BeezUP : <a href="mailto:help@beezup.com">help@beezup.com</a> (Magento BeezUP v4.0.0) - <a href="http://go.beezup.com" target="_blank">My BeezUP Account</a></div>]]></comment>
404
+ <sort_order>2</sort_order>
405
+ <show_in_default>1</show_in_default>
406
+ <show_in_website>1</show_in_website>
407
+ <show_in_store>1</show_in_store>
408
+ <fields>
409
+ <active translate="label">
410
+ <label>Enabled</label>
411
+ <comment><![CDATA[www.yoursite.com/beezup/catalog/xml<br />www.yoursite.com/beezup/catalog/configurable <br /> www.yoursite.com/beezup/catalog/child]]></comment>
412
+ <frontend_type>select</frontend_type>
413
+ <source_model>adminhtml/system_config_source_yesno</source_model>
414
+ <sort_order>1</sort_order>
415
+ <show_in_default>1</show_in_default>
416
+ <show_in_website>1</show_in_website>
417
+ <show_in_store>1</show_in_store>
418
+ </active>
419
+ <debug_flux translate="label">
420
+ <label>Debug Mode</label>
421
+ <comment><![CDATA[Limit the number of products]]></comment>
422
+ <frontend_type>select</frontend_type>
423
+ <source_model>adminhtml/system_config_source_yesno</source_model>
424
+ <sort_order>2</sort_order>
425
+ <show_in_default>1</show_in_default>
426
+ <show_in_website>1</show_in_website>
427
+ <show_in_store>1</show_in_store>
428
+ </debug_flux>
429
+ <stock translate="label">
430
+ <label>Filter out of stock products</label>
431
+ <frontend_type>select</frontend_type>
432
+ <source_model>adminhtml/system_config_source_yesno</source_model>
433
+ <sort_order>3</sort_order>
434
+ <show_in_default>1</show_in_default>
435
+ <show_in_website>1</show_in_website>
436
+ <show_in_store>1</show_in_store>
437
+ </stock>
438
+ <ship translate="label">
439
+ <label>Shipping (Incl. Tax)</label>
440
+ <frontend_type>text</frontend_type>
441
+ <sort_order>4</sort_order>
442
+ <show_in_default>1</show_in_default>
443
+ <show_in_website>1</show_in_website>
444
+ <show_in_store>1</show_in_store>
445
+ </ship>
446
+ <tablerates_weight_destination translate="label">
447
+ <label>Table Rates</label>
448
+ <comment><![CDATA[Use Table Rates (only Weight vs. Destination)]]></comment>
449
+ <frontend_type>select</frontend_type>
450
+ <source_model>adminhtml/system_config_source_yesno</source_model>
451
+ <sort_order>5</sort_order>
452
+ <show_in_default>1</show_in_default>
453
+ <show_in_website>1</show_in_website>
454
+ <show_in_store>1</show_in_store>
455
+ </tablerates_weight_destination>
456
+ <ht translate="label">
457
+ <label>Catalog Price</label>
458
+ <frontend_type>select</frontend_type>
459
+ <source_model>beezup/system_config_source_price</source_model>
460
+ <comment><![CDATA[Product Price Excl. Tax or Incl. Tax in catalog]]></comment>
461
+ <sort_order>6</sort_order>
462
+ <show_in_default>1</show_in_default>
463
+ <show_in_website>1</show_in_website>
464
+ <show_in_store>1</show_in_store>
465
+ </ht>
466
+ <vat translate="label">
467
+ <label>VAT Rates</label>
468
+ <frontend_type>text</frontend_type>
469
+ <sort_order>7</sort_order>
470
+ <show_in_default>1</show_in_default>
471
+ <show_in_website>1</show_in_website>
472
+ <show_in_store>1</show_in_store>
473
+ </vat>
474
+ <catalog_rules translate="label">
475
+ <label>Use Catalog Price Rules</label>
476
+ <comment><![CDATA[Let off if Catalog Price Rules are not used]]></comment>
477
+ <frontend_type>select</frontend_type>
478
+ <source_model>adminhtml/system_config_source_yesno</source_model>
479
+ <sort_order>8</sort_order>
480
+ <show_in_default>1</show_in_default>
481
+ <show_in_website>1</show_in_website>
482
+ <show_in_store>1</show_in_store>
483
+ </catalog_rules>
484
+ <days_in translate="label">
485
+ <label>Delivery Time if Product in Stock</label>
486
+ <frontend_type>text</frontend_type>
487
+ <comment><![CDATA[Enter eg 1-2 for 1 to 2 days]]></comment>
488
+ <sort_order>9</sort_order>
489
+ <show_in_default>1</show_in_default>
490
+ <show_in_website>1</show_in_website>
491
+ <show_in_store>1</show_in_store>
492
+ </days_in>
493
+ <days_out translate="label">
494
+ <label>Delivery Time if Product out of Stock</label>
495
+ <frontend_type>text</frontend_type>
496
+ <comment><![CDATA[Enter eg 6-8 for 6 to 8 days]]></comment>
497
+ <sort_order>10</sort_order>
498
+ <show_in_default>1</show_in_default>
499
+ <show_in_website>1</show_in_website>
500
+ <show_in_store>1</show_in_store>
501
+ </days_out>
502
+ <description translate="label">
503
+ <label>Product description</label>
504
+ <frontend_type>select</frontend_type>
505
+ <source_model>beezup/system_config_source_description</source_model>
506
+ <sort_order>11</sort_order>
507
+ <show_in_default>1</show_in_default>
508
+ <show_in_website>1</show_in_website>
509
+ <show_in_store>1</show_in_store>
510
+ </description>
511
+ <attributes translate="label">
512
+ <label>Specific Attributes</label>
513
+ <frontend_type>multiselect</frontend_type>
514
+ <source_model>beezup/system_config_source_attributes</source_model>
515
+ <sort_order>12</sort_order>
516
+ <show_in_default>1</show_in_default>
517
+ <show_in_website>1</show_in_website>
518
+ <show_in_store>1</show_in_store>
519
+ </attributes>
520
+ <ip translate="label">
521
+ <label>BeezUP Server IP address</label>
522
+ <comment><![CDATA[Only this IP address will be able to read the flow (leave empty to disable the restriction)]]></comment>
523
+ <frontend_type>text</frontend_type>
524
+ <sort_order>13</sort_order>
525
+ <show_in_default>1</show_in_default>
526
+ <show_in_website>1</show_in_website>
527
+ <show_in_store>1</show_in_store>
528
+ </ip>
529
+ <key translate="label">
530
+ <label>Key</label>
531
+ <frontend_type>text</frontend_type>
532
+ <comment><![CDATA[Protects the flow by a unique key (Eg: 85ds6f7): www.yoursite.com/beezup/catalog/xml/key/85ds6f7/]]></comment>
533
+ <sort_order>14</sort_order>
534
+ <show_in_default>1</show_in_default>
535
+ <show_in_website>1</show_in_website>
536
+ <show_in_store>1</show_in_store>
537
+ </key>
538
+ <bom translate="label">
539
+ <label>Bom</label>
540
+ <frontend_type>select</frontend_type>
541
+ <source_model>adminhtml/system_config_source_yesno</source_model>
542
+ <comment><![CDATA[Add Byte Order Mark (BOM)]]></comment>
543
+ <sort_order>15</sort_order>
544
+ <show_in_default>1</show_in_default>
545
+ <show_in_website>1</show_in_website>
546
+ <show_in_store>1</show_in_store>
547
+ </bom>
548
+ <cachedelay translate="label">
549
+ <label>Cache delay</label>
550
+ <frontend_type>select</frontend_type>
551
+ <source_model>beezup/system_config_source_cache</source_model>
552
+ <comment><![CDATA[Refresh time of the cache export file in hours]]></comment>
553
+ <sort_order>16</sort_order>
554
+ <show_in_default>1</show_in_default>
555
+ <show_in_website>1</show_in_website>
556
+ <show_in_store>1</show_in_store>
557
+ </cachedelay>
558
+ <images translate="label">
559
+ <label>Export all available pictures</label>
560
+ <frontend_type>select</frontend_type>
561
+ <source_model>beezup/system_config_source_images</source_model>
562
+ <comment><![CDATA[Export all available pictures]]></comment>
563
+ <sort_order>17</sort_order>
564
+ <show_in_default>1</show_in_default>
565
+ <show_in_website>1</show_in_website>
566
+ <show_in_store>1</show_in_store>
567
+ </images>
568
+
569
+ </fields>
570
+ </flux>
571
+ </groups>
572
+ </beezup>
573
+ </sections>
574
  </config>
app/code/community/BeezUp/lib/BeezupMageOrders.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupMageOrders {
4
+
5
+ public $id_order;
6
+ public $data = array();
7
+ public $Mageresource = null;
8
+ public $conection = null;
9
+
10
+ public function __construct($id_order) {
11
+ $this->id_order = $id_order;
12
+ }
13
+
14
+ public function setData($data) {
15
+ $this->data = $data;
16
+ }
17
+
18
+
19
+ public function updateShippingInfo() {
20
+ $this->updateSalesFlat();
21
+ $this->updateSalesInvoice();
22
+ }
23
+
24
+
25
+ public function updateBeezupInfo() {
26
+ if(!empty($this->data)) {
27
+ $this->getConnection();
28
+ $table = $this->getTableName("sales/order_grid");
29
+ $query = "select * from ".$table." where entity_id = '".$this->id_order."' ";
30
+ $results = $this->connection->fetchAll($query);
31
+ if(!empty($results)) {
32
+ $result = $results[0];
33
+ $query = $this->updateInfoTab($result, $table);
34
+ if($query) {
35
+ $this->getConnection("core_write");
36
+ $this->connection->query($query);
37
+ }
38
+ }
39
+ }
40
+
41
+ }
42
+
43
+ private function updateInfoTab($result, $table) {
44
+ $query = "update {$table} set ";
45
+ $blndentro = false;
46
+
47
+ if($this->data['beezup_status'] != $result['beezup_status']) {
48
+ $blndentro = true;
49
+ $query .= " beezup_status = '{$this->data['beezup_status'] }' ,";
50
+ }
51
+
52
+ if($this->data['beezup_last_modification_date'] != $result['beezup_last_modification_date']) {
53
+ $blndentro = true;
54
+ $query .= " beezup_last_modification_date = '{$this->data['beezup_last_modification_date'] }' ,";
55
+ }
56
+
57
+ if($this->data['beezup_marketplace_last_modification_date'] != $result['beezup_marketplace_last_modification_date']) {
58
+ $blndentro = true;
59
+ $query .= " beezup_marketplace_last_modification_date = '{$this->data['beezup_marketplace_last_modification_date'] }' ,";
60
+ }
61
+
62
+ if($this->data['beezup_total_paid'] != $result['beezup_total_paid']) {
63
+ $blndentro = true;
64
+ $query .= " beezup_total_paid = '{$this->data['beezup_total_paid'] }' ,";
65
+ }
66
+
67
+ if($this->data['beezup_comission'] != $result['beezup_comission']) {
68
+ $blndentro = true;
69
+ $query .= " beezup_comission = '{$this->data['beezup_comission'] }' ,";
70
+ }
71
+
72
+ if($this->data['beezup_marketplace_status'] != $result['beezup_marketplace_status']) {
73
+ $blndentro = true;
74
+ $query .= " beezup_marketplace_status = '{$this->data['beezup_marketplace_status'] }' ,";
75
+ }
76
+ if($blndentro) {
77
+ $query = substr($query, 0, -1);
78
+ $query .= " where entity_id = '{$this->id_order}' ";
79
+ return $query;
80
+
81
+ }
82
+ return false;
83
+ }
84
+
85
+
86
+ public function updateAdresses() {
87
+ if(!empty($this->data)) {
88
+ $this->getConnection();
89
+ $table = $this->getTableName("sales/order_address");
90
+ $query = "select * from ".$table." where parent_id = '".$this->id_order."' ";
91
+ $results = $this->connection->fetchAll($query);
92
+ foreach($results as $result) {
93
+ if($result['address_type'] == "billing") {
94
+ //update billing
95
+ $query = $this->updateBilling($result, $table);
96
+ if($query) {
97
+ $this->getConnection("core_write");
98
+ $this->connection->query($query);
99
+ }
100
+ } else {
101
+ //update shipping
102
+ $query = $this->updateShipping($result, $table);
103
+
104
+ if($query) {
105
+ $this->getConnection("core_write");
106
+ $this->connection->query($query);
107
+ }
108
+ }
109
+
110
+ }
111
+ }
112
+
113
+ }
114
+
115
+ private function updateShipping($result, $table) {
116
+ $query = "update {$table} set ";
117
+ $blndentro = false;
118
+
119
+ if($this->data['shipping_country'] != $result['country_id']) {
120
+ $blndentro = true;
121
+ $query .= " country_id = '{$this->data['shipping_country'] }' ,";
122
+ }
123
+ if($this->data['shipping_postcode'] != $result['postcode']) {
124
+ $blndentro = true;
125
+ $query .= " postcode = '{$this->data['shipping_postcode'] }' ,";
126
+ }
127
+
128
+ if($this->data['shipping_lastname'] != $result['lastname']) {
129
+ $blndentro = true;
130
+ $query .= " lastname = '{$this->data['shipping_lastname'] }' ,";
131
+ }
132
+ if($this->data['shipping_street'] != $result['street']) {
133
+ $blndentro = true;
134
+ $query .= " street = '{$this->data['shipping_street'] }' ,";
135
+ }
136
+ if($this->data['shipping_city'] != $result['city']) {
137
+ $blndentro = true;
138
+ $query .= " city = '{$this->data['shipping_city'] }' ,";
139
+ }
140
+ if($this->data['shipping_telephone'] != $result['telephone']) {
141
+ $blndentro = true;
142
+ $query .= " telephone = '{$this->data['shipping_telephone'] }' ,";
143
+ }
144
+ if($this->data['shipping_firstname'] != $result['firstname']) {
145
+ $blndentro = true;
146
+ $query .= " firstname = '{$this->data['shipping_firstname'] }' ,";
147
+ }
148
+
149
+ if($blndentro) {
150
+ $query = substr($query, 0, -1);
151
+ $query .= " where parent_id = '{$this->id_order}' and address_type = 'shipping'";
152
+ return $query;
153
+
154
+ }
155
+ return false;
156
+ }
157
+
158
+ private function updateBilling($result, $table) {
159
+ $query = "update {$table} set ";
160
+ $blndentro = false;
161
+
162
+ if($this->data['billing_country'] != $result['country_id']) {
163
+ $blndentro = true;
164
+ $query .= " country_id = '{$this->data['billing_country'] }' ,";
165
+ }
166
+ if($this->data['billing_postcode'] != $result['postcode']) {
167
+ $blndentro = true;
168
+ $query .= " postcode = '{$this->data['billing_postcode'] }' ,";
169
+ }
170
+
171
+ if($this->data['billing_lastname'] != $result['lastname']) {
172
+ $blndentro = true;
173
+ $query .= " lastname = '{$this->data['billing_lastname'] }' ,";
174
+ }
175
+ if($this->data['billing_street'] != $result['street']) {
176
+ $blndentro = true;
177
+ $query .= " street = '{$this->data['billing_street'] }' ,";
178
+ }
179
+ if($this->data['billing_city'] != $result['city']) {
180
+ $blndentro = true;
181
+ $query .= " city = '{$this->data['billing_city'] }' ,";
182
+ }
183
+ if($this->data['billing_telephone'] != $result['telephone']) {
184
+ $blndentro = true;
185
+ $query .= " telephone = '{$this->data['billing_telephone'] }' ,";
186
+ }
187
+ if($this->data['billing_firstname'] != $result['firstname']) {
188
+ $blndentro = true;
189
+ $query .= " firstname = '{$this->data['billing_firstname'] }' ,";
190
+ }
191
+
192
+ if($blndentro) {
193
+ $query = substr($query, 0, -1);
194
+ $query .= " where parent_id = '{$this->id_order}' and address_type = 'billing'";
195
+ return $query;
196
+
197
+ }
198
+ return false;
199
+
200
+ }
201
+
202
+ private function updateSalesInvoice() {
203
+ if(!empty($this->data)) {
204
+ $this->getConnection();
205
+ $table = $this->getTableName("sales/invoice");
206
+ $query = "select * from ".$table." where transaction_id = '".$this->id_order."' ";
207
+
208
+ $results = $this->connection->fetchAll($query);
209
+ if(!empty($results)) {
210
+ $result = $results[0];
211
+ if($result['shipping_amount'] != $this->data['shipping']) {
212
+ $query = $this->getSalesInvoiceWriteQuery($result, $table);
213
+ $this->getConnection("core_write");
214
+ $this->connection->query($query);
215
+ }
216
+ }
217
+
218
+ }
219
+
220
+ }
221
+
222
+ private function getSalesInvoiceWriteQuery($result, $table) {
223
+ $query = "update {$table} set base_shipping_amount = '{$this->data['shipping']}', shipping_amount = '{$this->data['shipping']}'" ;
224
+ $query .= $this->setQueryParameters($result, "base_grand_total", true);
225
+ $query .= $this->setQueryParameters($result, "grand_total", true);
226
+ $query .= " where transaction_id = '{$this->id_order}'";
227
+ return $query;
228
+ }
229
+
230
+
231
+
232
+
233
+
234
+ private function updateSalesFlat() {
235
+ if(!empty($this->data)) {
236
+ $this->getConnection();
237
+ $table = $this->getTableName("sales/order");
238
+ $query = "select * from ".$table." where entity_id = '".$this->id_order."' ";
239
+ $results = $this->connection->fetchAll($query);
240
+ if(!empty($results)) {
241
+ $result = $results[0];
242
+
243
+ if($result['shipping_amount'] != $this->data['shipping']) {
244
+
245
+ $query = $this->getSalesFlatWriteQuery($result, $table);
246
+ $this->getConnection("core_write");
247
+ $this->connection->query($query);
248
+ }
249
+ }
250
+
251
+ }
252
+
253
+ }
254
+
255
+
256
+ private function getSalesFlatWriteQuery($result, $table) {
257
+ $query = "update {$table} set base_shipping_amount = '{$this->data['shipping']}', shipping_amount = '{$this->data['shipping']}'" ;
258
+ $query .= $this->setQueryParameters($result, "base_shipping_invoiced");
259
+ $query .= $this->setQueryParameters($result, "shipping_invoiced");
260
+ $query .= $this->setQueryParameters($result, "base_grand_total", true);
261
+ $query .= $this->setQueryParameters($result, "base_total_invoiced", true);
262
+ $query .= $this->setQueryParameters($result, "base_total_paid", true);
263
+ $query .= $this->setQueryParameters($result, "grand_total", true);
264
+ $query .= $this->setQueryParameters($result, "total_invoiced", true);
265
+ $query .= $this->setQueryParameters($result, "total_paid", true);
266
+ $query .= $this->setQueryParameters($result, "base_total_paid", true);
267
+ $query .= $this->setQueryParameters($result, "total_paid", true);
268
+ $query .= " where entity_id = '{$this->id_order}'";
269
+ return $query;
270
+ }
271
+
272
+
273
+ private function setQueryParameters($result, $column, $isTotal = false) {
274
+ $query = "";
275
+ if($result[$column] > 0 && !empty($result[$column])) {
276
+ if($isTotal) {
277
+ $data = ($result[$column] - $result['shipping_amount']) + $this->data['shipping'];
278
+ $query = " , ".$column." = '{$data}'";
279
+ } else {
280
+ $query = " , ".$column." = '{$this->data['shipping']}'";
281
+ }
282
+
283
+ }
284
+ return $query;
285
+ }
286
+
287
+
288
+
289
+ private function getConnection($connection = "core_read") {
290
+ $this->Mageresource = Mage::getSingleton('core/resource');
291
+ $this->connection = $this->Mageresource->getConnection($connection);
292
+ }
293
+
294
+ private function getTableName($table) {
295
+ return $this->Mageresource->getTableName($table);
296
+ }
297
+
298
+
299
+
300
+
301
+ }
app/code/community/BeezUp/lib/BeezupOMDataHandler.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMDataHandler {
4
+
5
+ /**
6
+ * Words which don't
7
+ * @var unknown_type
8
+ */
9
+ protected $aGettersNameReplacement = array(
10
+ 'src' => array('BeezUP', 'UUID', 'ECommerce', 'LOV', 'CSharp', 'ETag', 'MarketPlace'),
11
+ 'tgt' => array('Beezup', 'Uuid', 'Ecommerce', 'Lov', 'Csharp', 'Etag', 'Marketplace')
12
+ );
13
+
14
+ protected $sUtcDateCastFormat = 'Y-m-d\TH:i:s\Z';//DateTime::ISO8601;
15
+
16
+ /**
17
+ * Creates new object from array
18
+ * @require PHP 5.3.0
19
+ * @param array $aData
20
+ * @return static Self
21
+ */
22
+ public static function fromArray(array $aData = array()){
23
+ $oResult = new static;
24
+ foreach ($aData as $sKey=>$mValue){
25
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($aMatches) {return strtoupper($aMatches[1]);}, strtolower($sKey));
26
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
27
+ if (method_exists($oResult,$sSetterMethod) && is_scalar($mValue)){
28
+ call_user_func(array($oResult,$sSetterMethod), stristr(strtolower($sKey),'utcdate') ? new DateTime($mValue, new DateTimeZone('UTC')) : $mValue);
29
+ } // if
30
+ } // foreach
31
+ return $oResult;
32
+ }
33
+
34
+ public function toArray(){
35
+ $aResult = array();
36
+ $oReflection = new ReflectionClass($this);
37
+ foreach ($oReflection->getMethods() as $oMethod){
38
+ $sName = $oMethod->getName();
39
+ if (substr($sName,0, 3) === 'get' && $sName !== 'getTransitionLinkByRel' && $sName !== 'getLinkByRel'){
40
+ $sName = str_replace($this->aGettersNameReplacement['src'], $this->aGettersNameReplacement['tgt'], $sName);
41
+ $sExportName = trim(strtolower(preg_replace('/([A-Z])/', '_$1', substr($sName, 3))), '_');
42
+ $aResult[$sExportName] = $this->convert(call_user_func(array($this, $oMethod->getName())));
43
+ }
44
+ }
45
+ return $aResult;
46
+ }
47
+
48
+ protected function convert($mValue){
49
+ if (is_object($mValue)){
50
+ if (method_exists($mValue, 'toArray')){
51
+ $mValue = call_user_func(array($mValue, 'toArray'));
52
+ } else if ($mValue instanceof DateTime){
53
+ $mValue = $mValue->format($this->sUtcDateCastFormat);
54
+ } else if (method_exists($mValue, '__toString')){
55
+ $mValue = (string)$mValue;
56
+ }
57
+ } else if (is_array($mValue)){
58
+ foreach ($mValue as $mKey => $mElement){
59
+ $mValue[$mKey] = $this->convert($mElement);
60
+ }
61
+ }
62
+ return $mValue;
63
+ }
64
+
65
+
66
+
67
+
68
+ }
app/code/community/BeezUp/lib/BeezupOMOrderService.php ADDED
@@ -0,0 +1,613 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Service class
5
+ */
6
+ class BeezupOMOrderService {
7
+
8
+ /**
9
+ * @var BeezupOMRepository
10
+ */
11
+ protected $oRepository = null;
12
+
13
+ /**
14
+ * @var BeezupOMServiceClientProxy
15
+ */
16
+ protected $oClientProxy = null;
17
+
18
+ protected $bDebugMode = false;
19
+
20
+ protected $aCache = array();
21
+
22
+ # MAGIC METHODS
23
+
24
+ /**
25
+ * @param BeezupOMRepositoryInterface $oRepository
26
+ * @param BeezupOMServiceClientProxy $oProxy
27
+ */
28
+ public function __construct(BeezupOMRepositoryInterface $oRepository){
29
+ $this
30
+ ->setRepository($oRepository)
31
+ ->setClientProxy(new BeezupOMServiceClientProxy($oRepository->getCredential()));
32
+ }
33
+
34
+ # GETTERS AND SETTERS
35
+
36
+ public function setDebugMode($bDebugMode = true){
37
+ $this->bDebugMode = (bool)$bDebugMode;
38
+ $this->getClientProxy()->setDebugMode($this->isDebugModeActivated());
39
+ $this->getRepository()->setDebugMode($this->isDebugModeActivated());
40
+
41
+ return $this;
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @return boolean True if debug is activated
47
+ */
48
+ public function isDebugModeActivated(){
49
+ return $this->bDebugMode;
50
+ }
51
+
52
+ /**
53
+ * @return BeezupOMRepository
54
+ */
55
+ public function getRepository(){
56
+ return $this->oRepository;
57
+ }
58
+
59
+ /**
60
+ * @param BeezupOMRepositoryInterface $oRepository
61
+ * @return BeezupOMOrderService
62
+ */
63
+ public function setRepository(BeezupOMRepositoryInterface $oRepository){
64
+ $this->oRepository = $oRepository;
65
+ return $this;
66
+ }
67
+
68
+ /**
69
+ * @return BeezupOMServiceClientProxy
70
+ */
71
+ public function getClientProxy(){
72
+ return $this->oClientProxy;
73
+ }
74
+
75
+ /**
76
+ * @param BeezupOMServiceClientProxy $oClientProxy
77
+ * @return BeezupOMOrderService
78
+ */
79
+ public function setClientProxy(BeezupOMServiceClientProxy $oClientProxy){
80
+ $this->oClientProxy = $oClientProxy;
81
+ return $this;
82
+ }
83
+
84
+ # PUBLIC API
85
+
86
+ public function purgeSync(){
87
+
88
+ $this->getRepository()->purgeSync();
89
+
90
+ }
91
+
92
+ /**
93
+ * Tests if credential is valid
94
+ * @return boolean
95
+ */
96
+ public function isCredentialValid(){
97
+ $oResult = $this->getClientProxy()->validate();
98
+ return $oResult && $oResult->getHttpStatus() === 204;
99
+ }
100
+
101
+ /**
102
+ *
103
+ * @param BeezupOMLink $oLink
104
+ * @param unknown_type $aParams
105
+ * @param unknown_type $aData
106
+ * @return boolean
107
+ */
108
+ public function changeOrder(BeezupOMLink $oLink, $aParams, $aData){
109
+
110
+ if (!$this->getRepository()->isConfigurationOk() || !$this->isCredentialValid()){
111
+ return array(false, null);
112
+ }
113
+
114
+ $aPostData = $this->processData($oLink, $aData);
115
+
116
+ $oResponse = $this->getClientProxy()->changeOrderByLink($oLink, $aParams, $aPostData);
117
+
118
+ return array(($oResponse && (int)$oResponse->getHttpStatus() === 200) , $oResponse);
119
+ }
120
+
121
+ /**
122
+ *
123
+ * @param BeezupOMOrderListRequest $oRequest
124
+ * @return boolean
125
+ */
126
+ public function synchronizeOrders(BeezupOMOrderListRequest $oRequest = null){
127
+
128
+ if ($oRequest === null){
129
+ $oRequest = $this->createOrderListRequest();
130
+ }
131
+
132
+ if (!$this->isOrderListRequestValid($oRequest)){
133
+ throw new Exception('BeezUP OM : Invalid request');
134
+ }
135
+ if (!$this->isConfigurationOk()){
136
+ throw new Exception('BeezUP OM : Invalid configuration');
137
+ }
138
+ if (!$this->isCredentialValid()){
139
+ throw new Exception('BeezUP OM : Invalid credentials');
140
+ }
141
+ if ($this->isSynchronizationAlreadyInProgress()){
142
+ throw new Exception('BeezUP OM : Synchronization in progress already');
143
+ }
144
+
145
+
146
+ $oLink = null;
147
+ $bHasErrors = false;
148
+ $nOrders = 0;
149
+
150
+ $oHarvestClientReporting = $this->createHarvestClientReporting($this->getRepository()->getCredential(), $oRequest->getBeginPeriodUtcDate(), $oRequest->getEndPeriodUtcDate());
151
+ try {
152
+ do {
153
+ if ($oLink){
154
+ $oResponse = $this->getClientProxy()->getOrderListByLink($oLink);
155
+ } else {
156
+ $oResponse = $this->getClientProxy()->getOrderList($oRequest);
157
+ }
158
+
159
+ if ($oResponse && $oResponse->getExecutionId()){
160
+ $this->getRepository()->saveHarvestClientReporting($oHarvestClientReporting, $oResponse->getExecutionId());
161
+ $oHarvestClientReporting->setExecutionId($oResponse->getExecutionId());
162
+ }
163
+
164
+ if ($oResponse && $oResponse->getResult() ){
165
+ if ($this->pushErrors($oResponse, $oHarvestClientReporting)){
166
+ break;
167
+ }
168
+ // getting response
169
+ $oOrderList = $oResponse->getResult();
170
+ $oPagination = $oOrderList->getPaginationResult();
171
+ if (!$oPagination){
172
+ break;
173
+ }
174
+ if ($oHarvestClientReporting){
175
+ // on first request only
176
+ if ($oLink === null){
177
+ $oHarvestClientReporting
178
+ ->setEntriesPerPage($oResponse->getRequest()->getEntriesPerPage())
179
+ ->setRemainingPageCount($oPagination->getTotalNumberOfPages())
180
+ ->getTotalOrderCount($oPagination->getTotalNumberOfEntries());
181
+ }
182
+ // on every request
183
+ $oHarvestClientReporting
184
+ ->setLastUpdateUtcDate(new DateTime('now', new DateTimeZone('UTC')))
185
+ ->setRemainingPageCount($oHarvestClientReporting->getRemainingPageCount() - 1);
186
+ // update reporting
187
+ $this->getRepository()->saveHarvestClientReporting($oHarvestClientReporting, $oResponse->getExecutionId());
188
+ }
189
+ // synchronizing page
190
+
191
+ $this->synchronizeOrderListPage($oOrderList, $oHarvestClientReporting);
192
+
193
+ // link to next page or null
194
+ $oLink = $oOrderList->getPaginationResult()->getLinkByRel('next');
195
+ } else {
196
+ $oLink = null;
197
+ }
198
+ } while($oLink);
199
+
200
+ } catch (Exception $oException){
201
+ $bHasErrors = true;
202
+ if ($oHarvestClientReporting){
203
+ $oHarvestClientReporting->setErrorMessage($oException->getMessage());
204
+ }
205
+ }
206
+ if ($oHarvestClientReporting){
207
+ // update & save reporting
208
+ $oHarvestClientReporting
209
+ ->setLastUpdateUtcDate(new DateTime('now', new DateTimeZone('UTC')))
210
+ ->setProcessingStatus($oHarvestClientReporting->getRemainingPageCount() == 0 ? BeezupOMProcessingStatus::SUCCEED : BeezupOMProcessingStatus::ABORTED);
211
+
212
+ $this->getRepository()->saveHarvestClientReporting($oHarvestClientReporting);
213
+ }
214
+ // update synchro date if we fetched at list one page so any error is not global (ie. no connexion errors ... )
215
+ if (!$bHasErrors && $oRequest->getEndPeriodUtcDate()){
216
+ $this->getRepository()->updateLastSynchronizationDate($oRequest->getEndPeriodUtcDate());
217
+ }
218
+ return true;
219
+ }
220
+
221
+ /**
222
+ *
223
+ * @param unknown_type $oBeezupOrderLinkOrId
224
+ */
225
+ public function synchronizeOrder($oBeezupOrderLinkOrId){
226
+ $bResult = false;
227
+ $sOperation = '';
228
+ $oHarvestOrderReporting = $this->createHarvestOrderReporting();
229
+ $oHarvestOrderReporting->setProcessingStatus(BeezupOMProcessingStatus::IN_PROGRESS);
230
+ $this->getRepository()->saveHarvestOrderReporting($oHarvestOrderReporting);
231
+ try {
232
+ $oBeezupOMOrderResponse = $this->getOrder($oBeezupOrderLinkOrId);
233
+ if ($oBeezupOMOrderResponse && $oBeezupOMOrderResponse->getResult()){
234
+ $oBeezupOrder = $oBeezupOMOrderResponse->getResult();
235
+ $oHarvestOrderReporting
236
+ ->setBeezupOrderUUID($oBeezupOrder->getBeezupOrderUUID())
237
+ ->setOrderDetailJson(json_encode($oBeezupOrder->toArray()));
238
+ $this->getRepository()->saveHarvestOrderReporting($oHarvestOrderReporting, $oBeezupOMOrderResponse->getExecutionId());
239
+ $oHarvestOrderReporting->setExecutionId($oBeezupOMOrderResponse->getExecutionId());
240
+
241
+ $oImportedOrderIdentifier = $this->getImportedOrderIdentifier($oBeezupOrder);
242
+ $oCurrentOrderIdentifier = BeezupOMOrderIdentifier::fromBeezupOrder($oBeezupOrder);
243
+ $bWasIdentifierImported = $this->wasIdentifierImported($oCurrentOrderIdentifier);
244
+
245
+ if (!$oImportedOrderIdentifier && !$bWasIdentifierImported){
246
+ // no order associated
247
+ $mResult = $this->getRepository()->createOrder($oBeezupOMOrderResponse);
248
+ if ($mResult){
249
+ try {
250
+ if ($mResult instanceof BeezupOMSetOrderIdValues && $oBeezupOrder->getLinkByRel('setMerchantOrderId')){
251
+ $oSetOrderIdResponse = $this->getClientProxy()
252
+ ->setOrderMerchantIdByLink($oBeezupOrder->getLinkByRel('setMerchantOrderId'), $mResult);
253
+ $this->pushErrors($oSetOrderIdResponse, $oHarvestOrderReporting);
254
+ $bResult = true;
255
+ $sOperation = 'create';
256
+ } // if
257
+ } catch (Exception $oException){
258
+ $oHarvestOrderReporting->setErrorMessage($oException->getMessage());
259
+ }
260
+
261
+ }
262
+ } else if (($oImportedOrderIdentifier && $this->isSameIdentifier($oCurrentOrderIdentifier, $oImportedOrderIdentifier) )|| $bWasIdentifierImported){
263
+ $mResult = $this->getRepository()->updateOrder($oBeezupOMOrderResponse);
264
+ if ($mResult){
265
+ try {
266
+ if ($mResult instanceof BeezupOMSetOrderIdValues && $oBeezupOrder->getLinkByRel('setMerchantOrderId')){
267
+ $oSetOrderIdResponse = $this->getClientProxy()
268
+ ->setOrderMerchantIdByLink($oBeezupOrder->getLinkByRel('setMerchantOrderId'), $mResult);
269
+ $this->pushErrors($oSetOrderIdResponse, $oHarvestOrderReporting);
270
+ $bResult = true;
271
+ $sOperation = 'update';
272
+ } // if
273
+ } catch (Exception $oException){
274
+ $oHarvestOrderReporting->setErrorMessage($oException->getMessage());
275
+ }
276
+ $bResult = true;
277
+ }
278
+
279
+ } else {
280
+ $oHarvestOrderReporting->setErrorMessage(sprintf('Order id mismatch %s', $oCurrentOrderIdentifier));
281
+
282
+ }
283
+ $oHarvestOrderReporting->setProcessingStatus($bResult ? BeezupOMProcessingStatus::SUCCEED : BeezupOMProcessingStatus::FAILED);
284
+ $this->getRepository()->saveHarvestOrderReporting($oHarvestOrderReporting);
285
+ } else{
286
+ $oHarvestOrderReporting->setProcessingStatus(BeezupOMProcessingStatus::FAILED);
287
+ $oHarvestOrderReporting->setErrorMessage('Unable to fetch order ' . $oBeezupOrderLinkOrId);
288
+ $this->getRepository()->saveHarvestOrderReporting($oHarvestOrderReporting);
289
+ }
290
+ } catch (Exception $oException) {
291
+ $oHarvestOrderReporting->setErrorMessage($oException->getMessage());
292
+ $oHarvestOrderReporting->setProcessingStatus(BeezupOMProcessingStatus::FAILED);
293
+ } // try
294
+ $this->getRepository()->saveHarvestOrderReporting($oHarvestOrderReporting);
295
+ return array($bResult, $sOperation);
296
+ }
297
+
298
+ /**
299
+ *
300
+ * @param BeezupOMLink|BeezupOMOrderIdentifier $oOrderLinkOrId
301
+ * @return NULL|Ambigous <NULL, BeezupOMOrderResponse, BeezupOMResponse>
302
+ */
303
+ public function getOrder($oOrderLinkOrId){
304
+ if ($oOrderLinkOrId instanceof BeezupOMOrderIdentifier){
305
+ $oOrderIdentifier = $oOrderLinkOrId;
306
+ $oOrderRequest = new BeezupOMOrderRequest();
307
+ $oOrderRequest
308
+ ->setOrderIdentifier($oOrderIdentifier);
309
+
310
+ $oCachedOrderResponse = $this->getRepository()->getCachedBeezupOrderResponse($oOrderIdentifier);
311
+ if ($oCachedOrderResponse && $oCachedOrderResponse->getEtag()){
312
+ $oOrderRequest->setETagIfNoneMatch($oCachedOrderResponse->getEtag());
313
+ }
314
+ $oResponse = $this->getClientProxy()->getOrder($oOrderRequest);
315
+ } else if ($oOrderLinkOrId instanceof BeezupOMLink){
316
+ $oResponse = $this->getClientProxy()->getOrderByLink($oOrderLinkOrId);
317
+ $oCachedOrderResponse = null;
318
+ $oOrderIdentifier = null;
319
+ } else {
320
+ return null;
321
+ }
322
+ if ($oResponse && $oResponse->getHttpStatus() === 304){
323
+ if ($oOrderLinkOrId instanceof BeezupOMLink){
324
+ $oOrderIdentifier = BeezupOMOrderIdentifier::fromBeezupOrderLink($oOrderLinkOrId);
325
+ $oCachedOrderResponse = $this->getRepository()->getCachedBeezupOrderResponse($oOrderIdentifier);
326
+ }
327
+ return $oCachedOrderResponse;
328
+ }
329
+ return ($oResponse && count($oResponse->getInfo()->getErrors()) == 0 && $oResponse->getResult()) ? $oResponse : null;
330
+ }
331
+
332
+ public function getOrderDirect(BeezupOMOrderIdentifier $oOrderIdentifier){
333
+ $oOrderIdentifier = $oOrderLinkOrId;
334
+ $oOrderRequest = new BeezupOMOrderRequest();
335
+ $oOrderRequest
336
+ ->setOrderIdentifier($oOrderIdentifier);
337
+ $oResponse = $this->getClientProxy()->getOrder($oOrderRequest);
338
+ return ($oResponse && count($oResponse->getInfo()->getErrors()) == 0 && $oResponse->getResult()) ? $oResponse : null;
339
+ }
340
+
341
+ public function getStores(){
342
+ $aResult = array();
343
+ $oResponse = $this->getClientProxy()->stores();
344
+ if ($oResponse && $oResponse->getResult()){
345
+ foreach ($oResponse->getResult()->getStores() as $oStore){
346
+ $aResult[$oStore->getBeezupStoreId()] = $oStore->getBeezupStoreName();
347
+ }
348
+ }
349
+ return $aResult;
350
+ }
351
+
352
+
353
+ /**
354
+ * @param string $sLOVListName
355
+ * @param string $sCultureName
356
+ * @return array
357
+ */
358
+ public function getLovValues($sLOVListName, $sCultureName = 'en') {
359
+ $aResult = array();
360
+ $oResult = $this->getLov($sLOVListName, $sCultureName);
361
+ if ($oResult){
362
+ foreach($oResult->getValues() as $oLovValue){
363
+ $aResult[$oLovValue->getCodeIdentifier()] = $oLovValue;
364
+ }
365
+ }
366
+ return $aResult;
367
+ }
368
+
369
+ public function getLOVValuesForParams(BeezupOMLink $oLink, $bRequired = true){
370
+ $aResult = array();
371
+ foreach ($oLink->getParameters() as $oParam){
372
+ if ($oParam->getLovLink() && (!$bRequired || $oParam->isLovRequired())) {
373
+ $oLovResult = $this->getLOVByLink($oParam->getLovLink());
374
+ $aResult[$oParam->getName()] = $oLovResult ? $oLovResult->toArray() : array();
375
+ } // if
376
+ } // foreach
377
+ return $aResult;
378
+ }
379
+
380
+ # PAGE SYNC
381
+
382
+ protected function synchronizeOrderListPage($oOrderList, $oHarvestClientReporting){
383
+
384
+ foreach ($oOrderList->getOrderHeaders() as $oOrderHeader){
385
+ $oOrderLink = $oOrderHeader->getLinkByRel('self');
386
+ if ($oOrderLink){
387
+ try {
388
+ $this->synchronizeOrder($oOrderLink);
389
+ } catch (Exception $oException){
390
+ if ($oHarvestClientReporting){
391
+ $oHarvestClientReporting->setErrorMessage($oException->getMessage());
392
+ }
393
+
394
+ }
395
+ } // if
396
+ }// foreach
397
+
398
+ }
399
+
400
+ # LOV helper
401
+
402
+ protected function getLovByLink(BeezupOMLink $oLink) {
403
+ $aAtoms = explode('cultureName=', $oLink->getHref(), 2);
404
+ $sCultureName = isset($aAtoms[1]) ? $aAtoms[1] : '';
405
+ $sCacheKey = sprintf('%s-%s', $oLink->getRel(), $sCultureName);
406
+ if (!isset($this->aCache[$sCacheKey])){
407
+ $oLovResponse = $this->getClientProxy()->getLOVByLink($oLink);
408
+ if ($oLovResponse && $oLovResponse->getResult()){
409
+ $this->aCache[$sCacheKey] = $oLovResponse->getResult();
410
+ }
411
+ }
412
+ return $this->aCache[$sCacheKey];
413
+ }
414
+
415
+ /**
416
+ * @param string $sLOVListName
417
+ * @param string $sCultureName
418
+ * @return multitype:
419
+ */
420
+ protected function getLov($sLOVListName, $sCultureName = 'en'){
421
+ $sCacheKey = sprintf('LOV_%s-%s', $sLOVListName, $sCultureName);
422
+ if (!isset($this->aCache[$sCacheKey])){
423
+ $aResult = array();
424
+ $oLovRequest = new BeezupOMLOVRequest();
425
+ $oLovRequest
426
+ ->setListName($sLOVListName)
427
+ ->setCultureName($sCultureName);
428
+ $oLovResponse = $this->getClientProxy()->getLOV($oLovRequest);
429
+ if ($oLovResponse && $oLovResponse->getResult()){
430
+ $this->aCache[$sCacheKey] = $oLovResponse->getResult();
431
+ }
432
+ }
433
+ return $this->aCache[$sCacheKey];
434
+ }
435
+
436
+ # VALIDATION FOR CHANGE ORDER
437
+
438
+ protected function processData(BeezupOMLink $oLink, array $aData = array()){
439
+ $aResult = array();
440
+ if ($oLink){
441
+ foreach ($oLink->getParameters() as $oParam){
442
+ $sName = $oParam->getName();
443
+ if ((!isset($aData[$sName]) || empty($aData[$sName]) && $oParam->isMandatory())){
444
+ throw new Exception(sprintf('Param %s cannot be empty',$sName));
445
+ }
446
+ if (!$this->validateParam($oParam, $aData[$sName])){
447
+ throw new Exception(sprintf('Param %s cannot be empty has invalid value %s', $sName, strval($aData[$sName])));
448
+ }
449
+ if ($oParam->getCSharpType() === 'System.DateTime'){
450
+ $aResult[$sName] = substr($aData[$sName],0,10) . 'T' . gmdate('H:i:s', time()-300) . '.000Z';
451
+ } else {
452
+ $aResult[$sName] = $aData[$sName];
453
+ }
454
+ }
455
+ }
456
+ return $aResult;
457
+ }
458
+
459
+ protected function validateLOVRequired(BeezupOMExpectedOrderChangeMetaInfo $oParam, $mValue){
460
+
461
+ if ($oParam->isLovRequired()){
462
+ $aValues = $this->getLOVCodes($oParam);
463
+ if (empty($aValues) || !in_array($mValue, $aValues)){
464
+ return false;
465
+ }
466
+ // @todo smart mapping / exchange as in lengow
467
+ }
468
+ return true;
469
+
470
+ }
471
+
472
+ protected function validateParam(BeezupOMExpectedOrderChangeMetaInfo $oParam, $mValue){
473
+ return $this->validateParamType($oParam, $mValue) && $this->validateLOVRequired($oParam, $mValue);
474
+ }
475
+
476
+ protected function validateParamType(BeezupOMExpectedOrderChangeMetaInfo $oParam, $mValue){
477
+ switch ($oParam->getCSharpType()){
478
+ default:
479
+ case 'System.String':
480
+ if (!is_string($mValue)){
481
+ return false;
482
+ }
483
+ break;
484
+ case 'System.Int32':
485
+ if (preg_match('/^[0-9]+$/', $mValue) !== 1){
486
+ return false;
487
+ }
488
+ break;
489
+ case 'System.Decimal':
490
+ case 'System.Money':
491
+ if (preg_match('/^[0-9]+(,[0-9]{0,3})?$/', $mValue) !== 1){
492
+ return false;
493
+ }
494
+ break;
495
+ case 'System.DateTime':
496
+ if (!strtotime($mValue)){
497
+ return false;
498
+ }
499
+ break;
500
+ }
501
+ return true;
502
+ }
503
+
504
+ protected function createOrderListRequest(){
505
+ $oResult = new BeezupOMOrderListRequest();
506
+ $oResult
507
+ ->setBeginPeriodUtcDate($this->getRepository()->getLastSynchronizationDate());
508
+ return $oResult;
509
+ }
510
+
511
+ protected function getLOVCodes(BeezupOMExpectedOrderChangeMetaInfo $oParam){
512
+ if ($oParam->isLovRequired()){
513
+ $oLovResponse = $this->getClientProxy()->getLOVByLink($oParam->getLovLink());
514
+ if ($oLovResponse && $oLovResponse->getResult()){
515
+ return $oLovResponse->getResult()->getCodeIdentifiers();
516
+ }
517
+ }
518
+ return array();
519
+ }
520
+
521
+ protected function pushErrors(BeezupOMResponse $oResponse, BeezupOMHarvestAbstractReporting $oReporting){
522
+ if ($oResponse->getInfo()->getErrors()) {
523
+ foreach($oResponse->getInfo()->getErrors() as $oError){
524
+ // @todo add error
525
+ $oReporting->setErrorMessage($oError->getCode() . ' ' . $oError->getMessage());
526
+ }
527
+ return true;
528
+ }
529
+ return false;
530
+
531
+ }
532
+
533
+ # REPORTING HELPERS
534
+
535
+ /**
536
+ * @return BeezupOMHarvestClientReporting
537
+ */
538
+ protected function createHarvestClientReporting(BeezupOMCredential $oCredential, DateTime $oBeginPeriodUtcDate, DateTime $oEndPeriodUtcDate, $sExecutionId = null){
539
+ $oResult = $this->initReportingObject(new BeezupOMHarvestClientReporting(), $sExecutionId);
540
+ $oResult
541
+ ->setBeginPeriodUtcDate($oBeginPeriodUtcDate)
542
+ ->setEndPeriodUtcDate($oBeginPeriodUtcDate)
543
+ ->setBeezUPApiToken($oCredential->getBeezupApiToken())
544
+ ->setBeezUPUserId($oCredential->getBeezupUserId());
545
+ $this->getRepository()->saveHarvestClientReporting($oResult);
546
+
547
+ return $oResult;
548
+ }
549
+
550
+ /**
551
+ * @return BeezupOMHarvestOrderReporting
552
+ */
553
+ protected function createHarvestOrderReporting($sExecutionId = null){
554
+ $oResult = $this->initReportingObject(new BeezupOMHarvestOrderReporting(), $sExecutionId);
555
+ $this->getRepository()->saveHarvestOrderReporting($oResult);
556
+ return $oResult;
557
+ }
558
+
559
+ /**
560
+ *
561
+ * @param BeezupOMHarvestAbstractReporting $oHarvestObject
562
+ * @param string $sProcessingStatus
563
+ */
564
+ protected function initReportingObject(BeezupOMHarvestAbstractReporting $oHarvestObject, $sExecutionId = null){
565
+ if ($sExecutionId === null){
566
+ $sExecutionId = md5(microtime(true) . spl_object_hash($oHarvestObject) . uniqid('bom'));
567
+ }
568
+ return $oHarvestObject
569
+ ->setExecutionId($sExecutionId)
570
+ ->setCreationUtcDate(new DateTime('now', new DateTimeZone('UTC')))
571
+ ->setProcessingStatus(BeezupOMProcessingStatus::IN_PROGRESS);
572
+ }
573
+
574
+ # CHECKS
575
+
576
+ protected function isOrderListRequestValid(BeezupOMOrderListRequest $oRequest){
577
+ return $oRequest->getBeginPeriodUtcDate() && $oRequest->getBeginPeriodUtcDate()->getTimestamp();
578
+ }
579
+
580
+ protected function isConfigurationOk(){
581
+ return $this->getRepository()->isConfigurationOk();
582
+ }
583
+
584
+ protected function isSynchronizationAlreadyInProgress(){
585
+ return $this->getRepository()->getCurrentHarvestSynchronization() !== null;
586
+ }
587
+
588
+ /**
589
+ *
590
+ * @param BeezupOMOrderResult $oBeezupOrder
591
+ */
592
+ protected function getImportedOrderIdentifier(BeezupOMOrderResult $oBeezupOrder){
593
+ return $this->getRepository()->getImportedOrderIdentifier((int)$oBeezupOrder->getOrderMerchantOrderId()) ;
594
+ }
595
+
596
+ /**
597
+ * Compares two identifiers
598
+ * @todo BeezupOMOrderIdentifier::compare ?
599
+ * @param BeezupOMOrderIdentifier $oOrderIdentifier1
600
+ * @param BeezupOMOrderIdentifier $oOrderIdentifier2
601
+ * @return boolean True if both identifiers are same
602
+ */
603
+ protected function isSameIdentifier(BeezupOMOrderIdentifier $oOrderIdentifier1, BeezupOMOrderIdentifier $oOrderIdentifier2){
604
+ return ($oOrderIdentifier1->getAccountId() === $oOrderIdentifier2->getAccountId() &&
605
+ $oOrderIdentifier1->getMarketplaceTechnicalCode() === $oOrderIdentifier2->getMarketplaceTechnicalCode() &&
606
+ $oOrderIdentifier1->getBeezupOrderUUID() === $oOrderIdentifier2->getBeezupOrderUUID());
607
+ }
608
+
609
+ protected function wasIdentifierImported(BeezupOMOrderIdentifier $oOrderIdentifier){
610
+ return $this->getRepository()->wasIdentifierImported($oOrderIdentifier) ;
611
+ }
612
+
613
+ }
app/code/community/BeezUp/lib/BeezupOMOrderServiceInterface.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ interface BeezupOMOrderServiceInterface {
4
+
5
+ public function changeOrder();
6
+ public function checkSynchronizationAlreadyInProgress();
7
+ public function synchronizeOrders();
8
+ public function synchronizeOrder();
9
+
10
+ }
app/code/community/BeezUp/lib/BeezupOMRepositoryInterface.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ interface BeezupOMRepositoryInterface {
4
+
5
+ # DEBUG HANDLING
6
+
7
+ /**
8
+ * Sets debug mode
9
+ * @param boolean $bDebugMode
10
+ */
11
+ public function setDebugMode($bDebugMode);
12
+
13
+ /**
14
+ * Tests if debug mode is activated
15
+ * @return boolean
16
+ */
17
+ public function isDebugModeActivated();
18
+
19
+ # CONFIGURATION
20
+
21
+ /**
22
+ * Checks configuration
23
+ * @return boolean True if configuration is OK
24
+ */
25
+ public function isConfigurationOk();
26
+
27
+ /**
28
+ * Returns credential object
29
+ * @return BeezupOMCredential
30
+ */
31
+ public function getCredential();
32
+
33
+ # ORDER HANDLING
34
+
35
+ /**
36
+ * Creates new Order
37
+ * @param BeezupOMOrderResponse $oBeezupOMOrderResponse
38
+ * @return BeezupOMSetOrderIdValues|bool BeezupOMSetOrderIdValues instance or false on fail
39
+ */
40
+ public function createOrder(BeezupOMOrderResponse $oBeezupOMOrderResponse);
41
+
42
+ /**
43
+ * Updates existing order
44
+ * @param BeezupOMOrderResponse $oBeezupOMOrderResponse
45
+ * @return integer New platform order status id
46
+ */
47
+ public function updateOrder(BeezupOMOrderResponse $oBeezupOMOrderResponse);
48
+
49
+ /**
50
+ * Gets cached Beezup order identifier associated with merchant order id
51
+ * @param integer $nMerchantOrderId
52
+ * @return BeezupOMOrderIdentifier|null
53
+ */
54
+ public function getImportedOrderIdentifier($nMerchantOrderId);
55
+
56
+ /**
57
+ * Gets cached Beezup order associated with beezup order id
58
+ * @param BeezupOMOrderIdentifier $oOrderIdentifier
59
+ * @return BeezupOMOrderResponse|null
60
+ */
61
+ public function getCachedBeezupOrderResponse(BeezupOMOrderIdentifier $oOrderIdentifier);
62
+
63
+ # SYNCHRONIZATION
64
+
65
+ /**
66
+ * @return DateTime $oLastSynchronizationDate
67
+ */
68
+ public function getLastSynchronizationDate();
69
+
70
+ /**
71
+ * Sets new LastSynchronizationDate
72
+ * @param DateTime $oLastSynchronizationDate
73
+ */
74
+ public function updateLastSynchronizationDate(DateTime $oLastSynchronizationDate);
75
+
76
+ /**
77
+ * Returns current (not finished) BeezupOMHarvestClientReporting
78
+ * @return BeezupOMHarvestClientReporting|null Current synchronization or null
79
+ */
80
+ public function getCurrentHarvestSynchronization();
81
+
82
+ /**
83
+ * Changes all synchronization with IN_PROGRESS TO TIMEOUT
84
+ */
85
+ public function purgeSync();
86
+
87
+ # REPORTING
88
+
89
+ /**
90
+ * Saves BeezupOMHarvestClientReporting (using execution_id as key unique). If $sNewExecutionId is given, it also updates execution_id
91
+ * @param BeezupOMHarvestClientReporting $oSource
92
+ * @param string $sNewExecutionId
93
+ */
94
+ public function saveHarvestClientReporting(BeezupOMHarvestClientReporting $oSource, $sNewExecutionId = null);
95
+
96
+ /**
97
+ * Saves BeezupOMHarvestOrderReporting (using execution_id as key unique). If $sNewExecutionId is given, it also updates execution_id
98
+ * @param BeezupOMHarvestOrderReporting $oSource
99
+ * @param string $sNewExecutionId
100
+ */
101
+ public function saveHarvestOrderReporting(BeezupOMHarvestOrderReporting $oSource, $sNewExecutionId = null);
102
+
103
+ }
app/code/community/BeezUp/lib/BeezupOMRequestData.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Container class for request data
5
+ */
6
+ class BeezupOMRequestData {
7
+
8
+ /**
9
+ * Request method
10
+ * @var string GET or POST
11
+ */
12
+ protected $sMethod = 'GET';
13
+
14
+ /**
15
+ * Additional headers
16
+ * @var array
17
+ */
18
+ protected $aHeaders = array();
19
+
20
+ /**
21
+ * Any additional query params
22
+ * @var array
23
+ */
24
+ protected $aParams = array();
25
+
26
+ /**
27
+ * Request url
28
+ * @var string
29
+ */
30
+ protected $sUrl = null;
31
+
32
+ protected $sBody = null;
33
+
34
+ /**
35
+ * @return the $sMethod
36
+ */
37
+ public function getMethod()
38
+ {
39
+ return $this->sMethod;
40
+ }
41
+
42
+ /**
43
+ * @param string $sMethod
44
+ */
45
+ public function setMethod($sMethod)
46
+ {
47
+ $this->sMethod = $sMethod;
48
+ return $this;
49
+ }
50
+
51
+ /**
52
+ * @return the $aHeaders
53
+ */
54
+ public function getHeaders()
55
+ {
56
+ return $this->aHeaders;
57
+ }
58
+
59
+ /**
60
+ * @param multitype: $aHeaders
61
+ */
62
+ public function setHeaders($aHeaders)
63
+ {
64
+ $this->aHeaders = $aHeaders;
65
+ return $this;
66
+ }
67
+
68
+ /**
69
+ * @return the $aParams
70
+ */
71
+ public function getParams()
72
+ {
73
+ return $this->aParams;
74
+ }
75
+
76
+ /**
77
+ * @param multitype: $aParams
78
+ */
79
+ public function setParams($aParams)
80
+ {
81
+ $this->aParams = $aParams;
82
+ return $this;
83
+ }
84
+
85
+ /**
86
+ * @return the $sUrl
87
+ */
88
+ public function getUrl()
89
+ {
90
+ return $this->sUrl;
91
+ }
92
+
93
+ /**
94
+ * @param NULL $sUrl
95
+ */
96
+ public function setUrl($sUrl)
97
+ {
98
+ $this->sUrl = $sUrl;
99
+ return $this;
100
+ }
101
+
102
+ public function setBody($sBody){
103
+ $this->sBody = $sBody;
104
+ return $this;
105
+ }
106
+
107
+ public function getBody(){
108
+ return $this->sBody;
109
+ }
110
+
111
+
112
+ }
app/code/community/BeezUp/lib/BeezupOMResponseData.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Container class for response data
5
+ */
6
+ class BeezupOMResponseData {
7
+
8
+ protected $aHeaders = array();
9
+ protected $mResponse = null;
10
+ protected $aCurlInfo = array();
11
+ protected $aCurlError = array();
12
+
13
+
14
+ /**
15
+ * @return $aHeaders
16
+ */
17
+ public function getHeaders()
18
+ {
19
+ return $this->aHeaders;
20
+ }
21
+
22
+ /**
23
+ * @param multitype: $aHeaders
24
+ * @return BeezupOMResponseData
25
+ */
26
+ public function setHeaders(array $aHeaders = array())
27
+ {
28
+ $this->aHeaders = $aHeaders;
29
+ return $this;
30
+ }
31
+
32
+ /**
33
+ * @return $mResponse
34
+ */
35
+ public function getResponse()
36
+ {
37
+ return $this->mResponse;
38
+ }
39
+
40
+ /**
41
+ * @param NULL $mResponse
42
+ * @return BeezupOMResponseData
43
+ */
44
+ public function setResponse($mResponse)
45
+ {
46
+ $this->mResponse = $mResponse;
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * @return $aCurlInfo
52
+ */
53
+ public function getCurlInfo()
54
+ {
55
+ return $this->aCurlInfo;
56
+ }
57
+
58
+ /**
59
+ * @param multitype: $aCurlInfo
60
+ * @return BeezupOMResponseData
61
+ */
62
+ public function setCurlInfo(array $aCurlInfo = array())
63
+ {
64
+ $this->aCurlInfo = $aCurlInfo;
65
+ return $this;
66
+ }
67
+
68
+ /**
69
+ * @return $aCurlError
70
+ */
71
+ public function getCurlError()
72
+ {
73
+ return $this->aCurlError;
74
+ }
75
+
76
+ /**
77
+ * @param multitype: $aCurlError
78
+ * @return BeezupOMResponseData
79
+ */
80
+ public function setCurlError(array $aCurlError = array())
81
+ {
82
+ $this->aCurlError = $aCurlError;
83
+ return $this;
84
+ }
85
+
86
+
87
+
88
+ }
app/code/community/BeezUp/lib/BeezupOMServiceClientProxy.php ADDED
@@ -0,0 +1,671 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Main class used to connect with BeezUP API
5
+ */
6
+ class BeezupOMServiceClientProxy {
7
+
8
+ # CLASS CONSTANTS
9
+
10
+ /**
11
+ * @var string Library version
12
+ */
13
+ const VERSION = '0.1';
14
+
15
+ // @todo define methods in one place
16
+ const METHOD_GET = 'GET';
17
+ const METHOD_POST = 'POST';
18
+ const METHOD_PATCH = 'PATCH';
19
+
20
+ # PRIVATE VARIABLES
21
+
22
+ /**
23
+ * API base - host
24
+ * @var string Host (with protocol, without trailing slash)
25
+ */
26
+ private $sBaseHost = 'https://api.beezup.com';
27
+
28
+ /**
29
+ * API base - path
30
+ * @var string Path part of URL, with trailing slashes
31
+ */
32
+ private $sBasePath = '/orders/v1/';
33
+
34
+ /**
35
+ * API credential
36
+ * @var BeezupOMCredential
37
+ */
38
+ private $oCredential = null;
39
+
40
+ /**
41
+ * cURL handler
42
+ * @var resource cURL handler
43
+ */
44
+ private $rCurl = null;
45
+
46
+ /**
47
+ * cURL initial options
48
+ * @var array
49
+ */
50
+ private $aCurlOptions = array(
51
+ CURLOPT_RETURNTRANSFER => true,
52
+ CURLOPT_TIMEOUT => 30,
53
+ CURLOPT_SSL_VERIFYHOST => false,
54
+ CURLOPT_SSL_VERIFYPEER => false
55
+ );
56
+
57
+ /**
58
+ * Debug mode. See BeezupOMServiceClientProxy::debug
59
+ * @var boolean
60
+ */
61
+ private $bDebugMode = false;
62
+
63
+ /**
64
+ * Current curl call headers
65
+ * @var array
66
+ */
67
+ private $aCurrentHeader = array();
68
+ # MAGIC METHODS
69
+
70
+ /**
71
+ * Class constructor
72
+ * @param BeezupOMCredential $oCredential
73
+ */
74
+ public function __construct(BeezupOMCredential $oCredential){
75
+ $this->setCredential($oCredential);
76
+ }
77
+
78
+ # SETTERS / GETTERS
79
+
80
+ /**
81
+ * Returns library version
82
+ * @return string Version string
83
+ */
84
+ public function getVersion(){
85
+ return self::VERSION;
86
+ }
87
+
88
+ /**
89
+ * Sets API credential
90
+ * @param BeezupOMCredential $oCredential
91
+ * @return BeezupOMServiceClientProxy Self
92
+ */
93
+ public function setCredential(BeezupOMCredential $oCredential){
94
+ $this->oCredential = $oCredential;
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * Gets API credential
100
+ * @return BeezupOMCredential API credential
101
+ */
102
+ public function getCredential(){
103
+ return $this->oCredential;
104
+ }
105
+
106
+ /**
107
+ */
108
+ public function setBaseHost($sBaseHost){
109
+ $this->sBaseHost = (string)$sBaseHost;
110
+ return $this;
111
+ }
112
+
113
+ /**
114
+ *
115
+ * @return string */
116
+ public function getBaseHost(){
117
+ return $this->sBaseHost;
118
+ }
119
+
120
+ /**
121
+ * Sets API's relative path
122
+ * @param string $sBasePath API's relative path, starting and ending with "/"
123
+ * @return BeezupOMServiceClientProxy
124
+ */
125
+ public function setBasePath($sBasePath){
126
+ $this->sBasePath = (string)$sBasePath;
127
+ return $this;
128
+ }
129
+
130
+ /**
131
+ * Gets API's relative path
132
+ * @return string Api relative path, starting and ending with "/"
133
+ */
134
+ public function getBasePath(){
135
+ return $this->sBasePath;
136
+ }
137
+
138
+ /**
139
+ * Returns API's base URL
140
+ * @return string Base url
141
+ */
142
+ public function getBaseUrl(){
143
+ return $this->getBaseHost() . $this->getBasePath();
144
+ }
145
+
146
+ /**
147
+ * Sets debug mode
148
+ * @param boolean $bDebugMode
149
+ * @return BeezupOMServiceClientProxy
150
+ */
151
+ public function setDebugMode($bDebugMode){
152
+ $this->bDebugMode = (bool)$bDebugMode;
153
+ return $this;
154
+ }
155
+
156
+ /**
157
+ * Returns debug mode
158
+ * @return boolean True if debug mode activated
159
+ */
160
+ public function getDebugMode(){
161
+ return $this->bDebugMode;
162
+ }
163
+
164
+ /**
165
+ * tests whether debug mode is activated
166
+ * @return boolean True if debug mode activated
167
+ */
168
+ public function isDebugModeActivated(){
169
+ return $this->bDebugMode;
170
+ }
171
+
172
+ # PUBLIC API
173
+
174
+ /**
175
+ * Those methods are primary methods of this library. They should be used to all operations
176
+ * One can use hand-crafted request (instance of BeezupOM*Request) or one of links sent by API (BeezupOMLink), transition or normal link
177
+ */
178
+
179
+ /**
180
+ * Simple call to verify if credentials and connection are ok
181
+ * @return BeezupOMResponse
182
+ */
183
+ public function validate(){
184
+ $oRequestData = $this->createRequestData()
185
+ ->setHeaders(array('Content-type: application/json'))
186
+ ->setUrl($this->getUrl(array('validate')));
187
+ $oResponse = $this->doRequest($oRequestData, new BeezupOMResponse());
188
+ return $oResponse;
189
+ } // validate
190
+
191
+ /**
192
+ * Returns list of all stores associated with account
193
+ * @return BeezupOMStoresResponse
194
+ */
195
+ public function stores(){
196
+ $oRequestData = $this->createRequestData()
197
+ ->setHeaders(array('Content-type: application/json'))
198
+ ->setUrl($this->getUrl(array('stores')));
199
+ $oResponse = $this->doRequest($oRequestData, new BeezupOMStoresResponse());
200
+ return $oResponse;
201
+ }
202
+
203
+ /**
204
+ * Sets merchant order id
205
+ * @param BeezupOMSetOrderIdRequest $oRequest
206
+ * @return BeezupOMSetOrderIdResponse
207
+ */
208
+ public function setOrderMerchantId(BeezupOMSetOrderIdRequest $oRequest){
209
+ $aUrlPath = array(
210
+ 'marketPlace' => $oRequest->getOrderIdentifier()->getMarketplaceTechnicalCode(),
211
+ 'accountId' => $oRequest->getOrderIdentifier()->getAccountId(),
212
+ 'beezUPOrderUUID' => $oRequest->getOrderIdentifier()->getBeezupOrderUUID(),
213
+ 'SetMerchantOrderId'=> 'SetMerchantOrderId'
214
+ );
215
+ $oRequestData = $this->createRequestData()
216
+ ->setUrl($this->getUrl($aUrlPath))
217
+ ->setMethod($oRequest->getMethod())
218
+ ->setHeaders(array('Content-type: application/json'))
219
+ ->setBody(json_encode($oRequest->getValues()->toArray()));
220
+ $oResponse = $this->doRequest($oRequestData, new BeezupOMSetOrderIdResponse());
221
+ return $oResponse;
222
+ }
223
+
224
+ /**
225
+ * Sets merchant order id
226
+ * @param BeezupOMLink $oLink
227
+ * @param BeezupOMSetOrderIdValues $oValues
228
+ * @return BeezupOMSetOrderIdResponse
229
+ */
230
+ public function setOrderMerchantIdByLink(BeezupOMLink $oLink, BeezupOMSetOrderIdValues $oValues){
231
+ $oRequestData = $this->createRequestData()
232
+ ->setUrl($this->getUrlFromLink($oLink))
233
+ ->setMethod($oLink->getMethod())
234
+ ->setHeaders(array('Content-type: application/json'))
235
+ ->setBody(json_encode($oValues->toArray()));
236
+ $oResponse = $this->doRequest($oRequestData, new BeezupOMSetOrderIdResponse());
237
+ return $oResponse;
238
+ }
239
+
240
+ /**
241
+ * Returns list of values (LOV). There are many LOVs possible, differentiated by name and culture
242
+ * @param BeezupOMLOVRequest $oRequest
243
+ * @return BeezupOMLOVResponse
244
+ */
245
+ public function getLOV(BeezupOMLOVRequest $oRequest){
246
+ $oRequestData = $this->createRequestData()
247
+ ->setHeaders(array('Content-type: application/json'))
248
+ ->setUrl($this->getUrl(array('lov', $oRequest->getListName()), array('cultureName' => $oRequest->getCultureName())));
249
+ $oResponse = $this->doRequest($oRequestData, new BeezupOMLOVResponse());
250
+ return $oResponse;
251
+ } // getLOV
252
+
253
+ /**
254
+ * Returns list of values (LOV). There are many LOVs possible, differentiated by name and culture
255
+ * @param BeezupOMLink $oLink
256
+ * @return BeezupOMLOVResponse
257
+ */
258
+ public function getLOVByLink(BeezupOMLink $oLink){
259
+ $oRequestData = $this->createRequestData()
260
+ ->setUrl($this->getUrlFromLink($oLink))
261
+ ->setHeaders(array('Content-type: application/json'))
262
+ ->setMethod($oLink->getMethod());
263
+ $oResponse = $this->doRequest($oRequestData, new BeezupOMLOVResponse());
264
+ return $oResponse;
265
+ } // getLOV
266
+
267
+ /**
268
+ * Returns list of orders for given params
269
+ * @param BeezupOMOrderListRequest $oRequest
270
+ * @return BeezupOMOrderListResponse
271
+ */
272
+ public function getOrderList(BeezupOMOrderListRequest $oRequest){
273
+ $aRequest = $oRequest->toArray();
274
+ $aRequest['beginPeriodUtcDate'] = $oRequest->getBeginPeriodUtcDate()->sub(new DateInterval("PT2H"))->format('Y-m-d\TH:i:s\Z');
275
+
276
+ $oRequestData = $this->createRequestData()
277
+ ->setUrl($this->getUrl(array(), $aRequest))
278
+ ->setHeaders(array('Content-type: application/json'))
279
+ ->setMethod($oRequest->getMethod());
280
+ $oResponse = $this->doRequest($oRequestData, new BeezupOMOrderListResponse());
281
+ return $oResponse;
282
+ } // getOrderList
283
+
284
+ /**
285
+ * Returns list of orders for given params
286
+ * @param BeezupOMLink $oLink
287
+ * @return BeezupOMOrderListResponse
288
+ */
289
+ public function getOrderListByLink(BeezupOMLink $oLink){
290
+ $oRequestData = $this->createRequestData()
291
+ ->setUrl($this->getUrlFromLink($oLink))
292
+ ->setHeaders(array('Content-type: application/json'))
293
+ ->setMethod($oLink->getMethod());
294
+ return $this->doRequest($oRequestData, new BeezupOMOrderListResponse());
295
+
296
+ }
297
+
298
+ /**
299
+ * Fetches order via link
300
+ * @param BeezupOMLink $oLink
301
+ * @return BeezupOMOrderResponse
302
+ */
303
+ public function getOrderByLink(BeezupOMLink $oLink){
304
+ $aHeaders = array();
305
+ $aHeaders[] = 'Content-type: application/json';
306
+ foreach ($oLink->getHeaders() as $mKey=>$sHeader){
307
+ $aHeaders[] = is_numeric($mKey) ? $sHeader : $mKey . ': ' . $sHeader;
308
+ }
309
+
310
+ $oRequestData = $this->createRequestData()
311
+ ->setUrl($this->getUrlFromLink($oLink))
312
+ ->setHeaders($aHeaders)
313
+ ->setMethod($oLink->getMethod());
314
+ return $this->doRequest($oRequestData, new BeezupOMOrderResponse());
315
+ } // getOrderByLink
316
+
317
+ /**
318
+ * Fetches order
319
+ * @param BeezupOMOrderRequest $oRequest
320
+ * @return BeezupOMOrderResponse
321
+ */
322
+ public function getOrder(BeezupOMOrderRequest $oRequest){
323
+ $aUrlPath = array(
324
+ 'marketPlace' => $oRequest->getOrderIdentifier()->getMarketplaceTechnicalCode(),
325
+ 'accountId' => $oRequest->getOrderIdentifier()->getAccountId(),
326
+ 'beezUPOrderUUID' => $oRequest->getOrderIdentifier()->getBeezupOrderUUID(),
327
+ );
328
+ $aUrlParams = array(
329
+ 'ignoreCurrentActivity' => $oRequest->ignoreCurrentActivity()
330
+ );
331
+ $aHeaders = array();
332
+ $aHeaders[] = 'Content-type: application/json';
333
+ if ($oRequest->getETagIfNoneMatch()){
334
+ $aHeaders[] = 'If-None-Match: '.$oRequest->getETagIfNoneMatch();
335
+ }
336
+
337
+ $oRequestData = $this
338
+ ->createRequestData()
339
+ ->setUrl($this->getUrl($aUrlPath, $aUrlParams))
340
+ ->setHeaders($aHeaders);
341
+
342
+ return $this->doRequest($oRequestData, new BeezupOMOrderResponse());
343
+ } // getOrder
344
+
345
+ /**
346
+ * Returns order history
347
+ * @param BeezupOMOrderHistoryRequest $oRequest
348
+ * @throws BadMethodCallException
349
+ * @stub
350
+ */
351
+ public function getOrderHistory(BeezupOMOrderHistoryRequest $oRequest){
352
+ throw new BadMethodCallException('Not implemented yet');
353
+ } // getOrderHistory
354
+
355
+ /**
356
+ * Changes order using transition link
357
+ * @param BeezupOMLink $oLink Link to execute
358
+ * @param array $aParams Url params to add (notably, userName and testMode)
359
+ * @param array $aPostData Post data to send
360
+ * @return BeezupOMOrderChangeResponse
361
+ */
362
+ public function changeOrderByLink(BeezupOMLink $oLink, array $aParams = array(), array $aPostData = array()){
363
+ $oRequestData = $this->createRequestData()
364
+ ->setUrl($this->getUrlFromLink($oLink, $aParams))
365
+ ->setMethod($oLink->getMethod())
366
+ ->setHeaders(array('Content-type: application/json'))
367
+ ->setBody(json_encode($aPostData));
368
+ return $this->doRequest($oRequestData, new BeezupOMOrderChangeResponse());
369
+ } // changeOrderByLink
370
+
371
+ /**
372
+ * Changes order
373
+ * @param BeezupOMOrderChangeRequest $oRequest
374
+ * @throws BadMethodCallException
375
+ * @stub
376
+ */
377
+ public function changeOrder(BeezupOMOrderChangeRequest $oRequest){
378
+ throw new BadMethodCallException('Not implemented yet');
379
+ } // changeOrder
380
+
381
+ # URL MANAGEMENT
382
+
383
+ /**
384
+ * Creates url for API call. Adds credentials.
385
+ * @param array $aParams
386
+ * @return string Well formed API url
387
+ */
388
+ protected function getUrl(array $aPath = array(), array $aParams = array()) {
389
+ if (!isset($aParams['subscription-key'])){
390
+ $aParams['subscription-key'] = $this->getCredential()->getBeezupApiToken();
391
+ } // if
392
+ array_unshift($aPath, $this->getCredential()->getBeezupUserId());
393
+ return $this->getBaseUrl() . implode('/', $aPath) . '?' . http_build_query($aParams);
394
+ } // getUrl
395
+
396
+ /**
397
+ * Creates url from BeezupOMLink object. Adds credentials.
398
+ * @param BeezupOMLink $oLink
399
+ * @param array $aParams
400
+ * @return string Well formed API url
401
+ */
402
+ protected function getUrlFromLink(BeezupOMLink $oLink, array $aParams = array()){
403
+ $sUrl = $this->getBaseHost() . $oLink->getHref();
404
+ if (stristr($sUrl, '?') !== false){
405
+ $aUrl = explode('?', $sUrl, 2);
406
+ $sUrl = $aUrl[0];
407
+ parse_str($aUrl[1], $aQuery);
408
+ } else {
409
+ $aQuery = array();
410
+ }
411
+ $aQuery = $aParams + $aQuery;
412
+ if (!isset($aQuery['subscription-key'])){
413
+ $aQuery['subscription-key'] = $this->getCredential()->getBeezupApiToken();
414
+ }
415
+ return $sUrl . '?' . http_build_query($aQuery);
416
+ } // getUrlFromLink
417
+
418
+ # REQUEST HANDLING
419
+
420
+ /**
421
+ * Returns container for all request data (such as url or method)
422
+ * @return BeezupOMRequestData
423
+ */
424
+ protected function createRequestData(){
425
+ return new BeezupOMRequestData();
426
+ } // createRequestData
427
+
428
+ /**
429
+ * Doing request
430
+ * This function return always object BeezupOM*Response, which has 3 properties : info, request and result
431
+ * Info (instance of BeezupOMInfoSummaries) is a container for all messages, (errors, warnings, sucesses, infos) from API and from network part
432
+ * of this library (ie. curl errors)
433
+ * Request (descendant of BeezupOMRequest) is a request object. IT IS NOT original request, but request rebuild from response (because for links we do not have
434
+ * such object)
435
+ * Result (descendant of BeezupOMResult) is probably the result you want to handle
436
+ * Request and Result are created by calling $oResponse::createResult and $oResponse::createRequest
437
+ * @param BeezupOMRequestData $oRequestData
438
+ * @param BeezupOMResponse $oResponse
439
+ * @return BeezupOMResponse
440
+ * @todo Etag handling
441
+ *
442
+ */
443
+ protected function doRequest(BeezupOMRequestData $oRequestData, BeezupOMResponse $oResponse){
444
+
445
+ $this->debug(PHP_EOL . str_repeat('=', 70) . PHP_EOL);
446
+ $this->debug(var_export($oRequestData, true));
447
+
448
+ $aResult = array();
449
+ $aReturnedRequest = array();
450
+ $oInfo = new BeezupOMInfoSummaries();
451
+ $oCurlResponse = $this->doCurlRequest($oRequestData);
452
+
453
+ $this->debug(var_export($oCurlResponse, true));
454
+
455
+ $aParsedResponse = $this->parseResponse($oCurlResponse->getResponse());
456
+ if ($aParsedResponse && is_array($aParsedResponse)){
457
+ if (isset($aParsedResponse['request']) && is_array($aParsedResponse['request'])){
458
+ $aReturnedRequest = (array)$aParsedResponse['request'];
459
+ } // if
460
+ if (isset($aParsedResponse['result']) && is_array($aParsedResponse['result'])){
461
+ $aResult = (array)$aParsedResponse['result'];
462
+ } // if
463
+ // any infos codes sent by Beezup API
464
+ if (isset($aParsedResponse['info']) && is_array($aParsedResponse['info'])){
465
+ // @todo: rather merge than overwrite
466
+ $oInfo = $oInfo->merge($aParsedResponse['info']);
467
+ } // if
468
+ // azure error codes, notably identification error
469
+ if (isset($aParsedResponse['message']) && isset($aParsedResponse['statusCode'])){
470
+ $oInfo->addError(new BeezupOMErrorSummary($aParsedResponse['statusCode'], $aParsedResponse['message']));
471
+ } // if
472
+ $oResponse->parseRawResponse($aParsedResponse);
473
+ }
474
+
475
+ // curl errors
476
+ $aCurlError = $oCurlResponse->getCurlError();
477
+ if ($aCurlError && isset($aCurlError['code']) && (int)$aCurlError['code'] != 0){
478
+ $oInfo->addError(new BeezupOMErrorSummary($aCurlError['code'], $aCurlError['message']));
479
+ }
480
+
481
+ $aCurlInfo = $oCurlResponse->getCurlInfo();
482
+ // HTTP codes others than 200, 204, 304 (0 means http request failed and have curl error, it is probably in $aCurlError)
483
+ if ($aCurlInfo && is_array($aCurlInfo) && isset($aCurlInfo['http_code']) && (!in_array((int)$aCurlInfo['http_code'], array(0, 200, 204, 304)) )){
484
+ $oInfo->addError(new BeezupOMErrorSummary($aCurlInfo['http_code'], 'HTTP Error'));
485
+ } // if
486
+
487
+ $oReturnedRequest = $oResponse->createRequest($aReturnedRequest);
488
+ $oResult = $oResponse->createResult($aResult);
489
+
490
+ // @todo See if we can stick it at one level
491
+ if (method_exists($oResponse, 'setHttpStatus')){
492
+ call_user_func(array($oResponse, 'setHttpStatus'), (int)$aCurlInfo['http_code']);
493
+ }
494
+ if (method_exists($oResult, 'setHttpStatus')){
495
+ call_user_func(array($oResult, 'setHttpStatus'), (int)$aCurlInfo['http_code']);
496
+ }
497
+
498
+ $aHeaders = $oCurlResponse->getHeaders();
499
+
500
+ foreach (array('ETag' => 'setEtag', 'BeezUPHttpExecutionUUID' => 'setExecutionId') as $sHeaderName=>$sSetter)
501
+ foreach (array($oResponse, $oResult) as $oTarget){
502
+ if (method_exists($oTarget, $sSetter) && isset($aHeaders[$sHeaderName])){
503
+ call_user_func(array($oTarget, $sSetter), $aHeaders[$sHeaderName]);
504
+ }
505
+ }
506
+
507
+ /**
508
+ * Code 304 => not modified
509
+ */
510
+ if ($aCurlInfo && is_array($aCurlInfo) && isset($aCurlInfo['http_code']) && (int)$aCurlInfo['http_code'] === 304){
511
+ $oResponse->setNotModified(true);
512
+ }
513
+
514
+ $oResponse
515
+ ->setInfo($oInfo)
516
+ ->setRequest($oReturnedRequest)
517
+ ->setResult($oResult);
518
+
519
+ $this->debug(var_export($oResponse, true));
520
+
521
+ return $oResponse;
522
+ } // doRequest
523
+
524
+ /**
525
+ * Parses raw response into array
526
+ * @param string $sResponse Valid JSON
527
+ * @return array|null Parsed response or null
528
+ */
529
+ protected function parseResponse($sResponse){
530
+ return json_decode($sResponse, true);
531
+ } // parseResponse
532
+
533
+ # CURL MANAGEMENT
534
+
535
+ /**
536
+ * Returns curl handle. Creates and sets new handle if necessary
537
+ * @return resource Curl handle
538
+ */
539
+ protected function getCurlHandle(){
540
+ if ($this->rCurl === null) {
541
+ $this->rCurl = $this->createCurlHandle();
542
+ } // if
543
+ return $this->rCurl;
544
+ } // getCurlHandle
545
+
546
+ /**
547
+ * Creates new curl handle, using options from self::aCurlOptions
548
+ * @return resource cUrl handle
549
+ */
550
+ protected function createCurlHandle(){
551
+ if (extension_loaded('curl')){
552
+ $rCurl = curl_init();
553
+ if (!is_resource($rCurl)){
554
+ throw new RuntimeException('BeezupOM: Unable to create curl handle.');
555
+ }
556
+ curl_setopt_array($rCurl, $this->aCurlOptions);
557
+ curl_setopt($rCurl, CURLOPT_HEADERFUNCTION, array($this, 'curlHeaderCallback'));
558
+ return $rCurl;
559
+ } else {
560
+ throw new RuntimeException('BeezupOM: You need to activate curl extension!');
561
+ }
562
+ } // createCurlHandle
563
+
564
+ /**
565
+ * makes actual curl call
566
+ * @param BeezupOMRequestData $oRequestData Shiny little object
567
+ * @return BeezupOMResponseData
568
+ */
569
+ protected function doCurlRequest(BeezupOMRequestData $oRequestData) { // $sUrl, $sMethod = self::METHOD_GET, array $aHeaders = array(), array $aParams = array()) {
570
+
571
+ if ($this->isDebugModeActivated()){
572
+ if (PHP_SAPI === 'cli') {
573
+ print PHP_EOL . $oRequestData->getMethod() .' ' . $oRequestData->getUrl();
574
+ print PHP_EOL . implode(' | ', $oRequestData->getHeaders());
575
+ } else {
576
+ print PHP_EOL . sprintf('<div style="padding:10px; margin:10px; background-color: #cfc">%1$s <a href="%2$s " target="_blank">%2$s </a> <br />%3$s</div>',$oRequestData->getMethod(),$oRequestData->getUrl(), implode(' | ', $oRequestData->getHeaders()));
577
+ }
578
+ }
579
+
580
+ $this->aCurrentHeader = array();
581
+ $sMethod = $oRequestData->getMethod() ? $oRequestData->getMethod() : self::METHOD_GET;
582
+ // @todo We are forced to recreate handle because CURLOPT_HTTPGET do not reset CURLOPT_CUSTOMREQUEST; there is need to do more testing
583
+ $rCurl = $this->createCurlHandle();
584
+ if ($sMethod !== self::METHOD_GET) {
585
+ if ($sMethod === self::METHOD_POST){
586
+ curl_setopt($rCurl, CURLOPT_POST, true);
587
+ } else {
588
+ curl_setopt($rCurl, CURLOPT_CUSTOMREQUEST, $sMethod);
589
+ }
590
+ if ($oRequestData->getBody()){
591
+ curl_setopt($rCurl, CURLOPT_POSTFIELDS, $oRequestData->getBody());
592
+ } else if ($oRequestData->getParams()){
593
+ curl_setopt($rCurl, CURLOPT_POSTFIELDS, http_build_query($oRequestData->getParams()));
594
+ } // if
595
+ } else {
596
+ curl_setopt($rCurl, CURLOPT_HTTPGET, true);
597
+ if ($oRequestData->getParams()){
598
+ // @todo Do it more elegant way
599
+ $sUrl = $sUrl . (stristr($sUrl, '?') ? '&' : '?') . http_build_query($oRequestData->getParams());
600
+ } // if
601
+ } // if
602
+ if ($oRequestData->getHeaders()) {
603
+ curl_setopt($rCurl, CURLOPT_HTTPHEADER, $oRequestData->getHeaders());
604
+ }
605
+
606
+ curl_setopt($rCurl, CURLOPT_URL, $oRequestData->getUrl());
607
+ $mCurlResponse = curl_exec($rCurl);
608
+
609
+ $this->debug(var_export($mCurlResponse, true));
610
+
611
+ $oResponse = new BeezupOMResponseData();
612
+ $oResponse
613
+ ->setResponse($mCurlResponse)
614
+ ->setHeaders($this->aCurrentHeader)
615
+ ->setCurlInfo(curl_getinfo($rCurl))
616
+ ->setCurlError(array('code' => curl_errno($rCurl), 'message' => curl_error($rCurl)));
617
+
618
+ if ($this->isDebugModeActivated()){
619
+ $aCurlInfo = $oResponse->getCurlInfo();
620
+ if (PHP_SAPI === 'cli') {
621
+
622
+ print PHP_EOL . ($aCurlInfo && isset($aCurlInfo['http_code']) ? $aCurlInfo['http_code'] : 'XXX ' . var_export($aCurlInfo, true));
623
+ } else {
624
+ print PHP_EOL . sprintf('<div style="padding:10px; margin:10px; background-color: #ccf">%1$s %2$d bytes</div>', ($aCurlInfo && isset($aCurlInfo['http_code']) ? $aCurlInfo['http_code'] : 'XXX'), strlen($mCurlResponse));
625
+ }
626
+ }
627
+
628
+
629
+ return $oResponse;
630
+ } // doCurlRequest
631
+
632
+ /**
633
+ * Parse curl headers
634
+ * @param resource $rCurl
635
+ * @param string $sHeaderLine
636
+ * @return number
637
+ */
638
+ public function curlHeaderCallback($rCurl, $sHeaderLine){
639
+ if (stristr($sHeaderLine, ':') !== false){
640
+ list($sName, $sContent) = explode(':', $sHeaderLine, 2);
641
+ $sName = trim($sName);
642
+ $sContent = trim($sContent);
643
+ if ($sName && $sContent){
644
+ if (isset($this->aCurrentHeader[$sName])){
645
+ if (!is_array($this->aCurrentHeader[$sName])){
646
+ $this->aCurrentHeader[$sName] = array($this->aCurrentHeader[$sName]);
647
+ }
648
+ $this->aCurrentHeader[$sName][] = $sContent;
649
+ } else {
650
+ $this->aCurrentHeader[$sName] = $sContent;
651
+ }
652
+ }
653
+ }
654
+ return strlen($sHeaderLine);
655
+ }
656
+
657
+ # DEBUG
658
+
659
+ /**
660
+ * Writing log messages to file beezup-om-log-<Ymd>.log in the same dir
661
+ * @param string $sMessage
662
+ * @return int|bool|null Writing result as in file_put_contents or null if debug mode not activated
663
+ */
664
+ protected function debug($sMessage) {
665
+ if ($this->isDebugModeActivated() ){
666
+ return file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . 'beezup-om-log-' . date('Ymd') . '.log', PHP_EOL. $sMessage, FILE_APPEND);
667
+ } // if
668
+ return null;
669
+ } // debug
670
+
671
+ }
app/code/community/BeezUp/lib/BeezupRepository.php ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class BeezupRepository implements BeezupOMRepositoryInterface {
3
+
4
+ protected $oProductIdentityMapper = null;
5
+ protected $aFirstNamesCache = null;
6
+ protected $oCredential = null;
7
+ protected $oModule = null;
8
+ protected $bDebugMode = null;
9
+
10
+ protected $bConnectionTestCache = null;
11
+
12
+
13
+ public function getStores() {
14
+ $service = new BeezupOMOrderService($this);
15
+ return $service->getStores();
16
+ }
17
+
18
+ public function isConnectionOk(){
19
+ if ($this->bConnectionTestCache===null){
20
+ $helper = Mage::helper('beezup');
21
+
22
+ /* Initially load the useful elements */
23
+ $helper = Mage::helper('beezup');
24
+
25
+ $userid = $helper->getConfig('beezup/marketplace/userid');
26
+ $usertoken = $helper->getConfig('beezup/marketplace/usertoken');
27
+
28
+
29
+ if (!$userid || !$usertoken){
30
+ $this->bConnectionTestCache = false;
31
+ }
32
+ try {
33
+ $service = new BeezupOMOrderService($this);
34
+ $this->bConnectionTestCache = ((int)$service->isCredentialValid());
35
+ } catch (Exception $oException){
36
+ $this->bConnectionTestCache = false;
37
+ }
38
+ }
39
+ return $this->bConnectionTestCache;
40
+ }
41
+
42
+
43
+
44
+
45
+ /**
46
+ *
47
+ * @param BeezupOMCredential $oCredential
48
+ * @return BeezupOMController
49
+ */
50
+ public function setCredential(BeezupOMCredential $oCredential)
51
+ {
52
+ $this->oCredential = $oCredential;
53
+ return $this;
54
+ }
55
+ /**
56
+ *
57
+ * @return BeezupOMCredential
58
+ */
59
+ public function getCredential()
60
+ {
61
+ if ($this->oCredential === null)
62
+ {
63
+ $this->setCredential ( $this->createCredential () );
64
+ }
65
+ return $this->oCredential;
66
+ }
67
+
68
+ protected function createCredential()
69
+ {
70
+ $helper = Mage::helper('beezup');
71
+
72
+ $userid = $helper->getConfig('beezup/marketplace/userid');
73
+ $usertoken = $helper->getConfig('beezup/marketplace/usertoken');
74
+
75
+ return new BeezupOMCredential ( $userid, $usertoken);
76
+ }
77
+
78
+ # DEBUG HANDLING
79
+
80
+ /**
81
+ * Sets debug mode
82
+ * @param boolean $bDebugMode
83
+ */
84
+
85
+ public function isDebugModeActivated()
86
+ {
87
+ return $this->bDebugMode;
88
+ }
89
+ public function setDebugMode($bDebugMode)
90
+ {
91
+ $this->bDebugMode = $bDebugMode;
92
+ return $this;
93
+ }
94
+
95
+ # CONFIGURATION
96
+
97
+ /**
98
+ * Checks configuration
99
+ * @return boolean True if configuration is OK
100
+ */
101
+ public function isConfigurationOk() {
102
+
103
+ return true;
104
+ }
105
+
106
+
107
+
108
+ # ORDER HANDLING
109
+
110
+ /**
111
+ * Creates new Order
112
+ * @param BeezupOMOrderResponse $oBeezupOMOrderResponse
113
+ * @return BeezupOMSetOrderIdValues|bool BeezupOMSetOrderIdValues instance or false on fail
114
+ */
115
+ public function createOrder(BeezupOMOrderResponse $oBeezupOMOrderResponse) {
116
+
117
+
118
+ return false;
119
+ }
120
+
121
+ /**
122
+ * Updates existing order
123
+ * @param BeezupOMOrderResponse $oBeezupOMOrderResponse
124
+ * @return integer New platform order status id
125
+ */
126
+ public function updateOrder(BeezupOMOrderResponse $oBeezupOMOrderResponse) {
127
+
128
+ return 1;
129
+ }
130
+
131
+ /**
132
+ * Gets cached Beezup order identifier associated with merchant order id
133
+ * @param integer $nMerchantOrderId
134
+ * @return BeezupOMOrderIdentifier|null
135
+ */
136
+ public function getImportedOrderIdentifier($nMerchantOrderId) {
137
+
138
+ return null;
139
+ }
140
+
141
+ /**
142
+ * Gets cached Beezup order associated with beezup order id
143
+ * @param BeezupOMOrderIdentifier $oOrderIdentifier
144
+ * @return BeezupOMOrderResponse|null
145
+ */
146
+ public function getCachedBeezupOrderResponse(BeezupOMOrderIdentifier $oOrderIdentifier) {
147
+
148
+ return null;
149
+ }
150
+
151
+ # SYNCHRONIZATION
152
+
153
+ /**
154
+ * @return DateTime $oLastSynchronizationDate
155
+ */
156
+ public function getLastSynchronizationDate() {
157
+ $oResult = new DateTime ( 'now', new DateTimeZone ( 'UTC' ) );
158
+ $helper = Mage::helper('beezup');
159
+ $nTime = (int)$helper->getConfig('beezup/marketplace/syncro_time');
160
+ $nTime = strtotime($nTime) - 7200;
161
+ if ($nTime)
162
+ {
163
+ $oResult->setTimestamp ( $nTime );
164
+ }
165
+ return $oResult;
166
+
167
+ }
168
+
169
+ /**
170
+ * Sets new LastSynchronizationDate
171
+ * @param DateTime $oLastSynchronizationDate
172
+ */
173
+ public function updateLastSynchronizationDate(DateTime $oLastSynchronizationDate) {
174
+ $helper = Mage::getModel('core/config');
175
+ $helper->saveConfig('beezup/marketplace/syncro_time',$oLastSynchronizationDate->getTimestamp());
176
+ return $this;
177
+ }
178
+
179
+ /**
180
+ * Returns current (not finished) BeezupOMHarvestClientReporting
181
+ * @return BeezupOMHarvestClientReporting|null Current synchronization or null
182
+ */
183
+ public function getCurrentHarvestSynchronization() {
184
+ $helper = Mage::helper('beezup');
185
+ return $helper->getConfig('beezup/marketplace/syncro_time');
186
+ }
187
+
188
+ /**
189
+ * Changes all synchronization with IN_PROGRESS TO TIMEOUT
190
+ */
191
+ public function purgeSync() {
192
+ foreach (BeezupHarvestClient::getByProcessingStatus ( BeezupOMProcessingStatus::IN_PROGRESS ) as $aHarvest)
193
+ {
194
+ $oHarvestClient = new BeezupHarvestClient ( (int)$aHarvest['id_harvest_client'] );
195
+ $oHarvestClient->processing_status = BeezupOMProcessingStatus::TIMEOUT;
196
+ $oHarvestClient->update ();
197
+ }
198
+
199
+ }
200
+
201
+ # REPORTING
202
+
203
+ /**
204
+ * Saves BeezupOMHarvestClientReporting (using execution_id as key unique). If $sNewExecutionId is given, it also updates execution_id
205
+ * @param BeezupOMHarvestClientReporting $oSource
206
+ * @param string $sNewExecutionId
207
+ */
208
+ public function saveHarvestClientReporting(BeezupOMHarvestClientReporting $oSource, $sNewExecutionId = null) {
209
+ $oBeezupHarvestClient = BeezupHarvestClient::createFromOMObject ( $oSource );
210
+ if ($oBeezupHarvestClient && is_string ( $sNewExecutionId ) && $sNewExecutionId != $oBeezupHarvestClient->execution_id)
211
+ {
212
+ $oBeezupHarvestClient->execution_id = $sNewExecutionId;
213
+ $oBeezupHarvestClient->update ();
214
+ }
215
+ return (bool)$oBeezupHarvestClient;
216
+
217
+ }
218
+
219
+ /**
220
+ * Saves BeezupOMHarvestOrderReporting (using execution_id as key unique). If $sNewExecutionId is given, it also updates execution_id
221
+ * @param BeezupOMHarvestOrderReporting $oSource
222
+ * @param string $sNewExecutionId
223
+ */
224
+ public function saveHarvestOrderReporting(BeezupOMHarvestOrderReporting $oSource, $sNewExecutionId = null) {
225
+ $oBeezupHarvestOrder = BeezupHarvestOrder::createFromOMObject ( $oSource );
226
+ if ($oBeezupHarvestOrder && is_string ( $sNewExecutionId ) && $sNewExecutionId != $oBeezupHarvestOrder->execution_id)
227
+ {
228
+ $oBeezupHarvestOrder->execution_id = $sNewExecutionId;
229
+ $oBeezupHarvestOrder->update ();
230
+ }
231
+ return (bool)$oBeezupHarvestOrder;
232
+
233
+ }
234
+
235
+
236
+
237
+
238
+
239
+ /**
240
+ *
241
+ * @param BeezupOMOrderItem $oItem
242
+ * @return array
243
+ */
244
+ /*
245
+ protected function findProduct(BeezupOMOrderItem $oItem)
246
+ {
247
+ $aResult = array();
248
+ $aMappingCallbacks = $this->getProductIdentityMapper ()->getMappingCallbacks ( $oItem->getOrderItemBeezUPStoreId () );
249
+ $aSearch = array_unique ( array_filter ( array(
250
+ $oItem->getOrderItemMerchantImportedProductId (),
251
+ $oItem->getOrderItemMerchantProductId ()
252
+ ) ) );
253
+ foreach ($aMappingCallbacks as $oMappingCallback)
254
+ {
255
+
256
+ $aFound = array();
257
+ foreach ($aSearch as $sTerm)
258
+ {
259
+ $aFound = array_merge ( $aFound, $oMappingCallback->findAll ( $sTerm ) );
260
+ }
261
+ $aResult = array_merge ( $aResult, array_unique ( $aFound, SORT_REGULAR ) );
262
+ }
263
+ $aResult = array_unique ( $aResult, SORT_REGULAR );
264
+ foreach ($aResult as $nKey => $aRow)
265
+ {
266
+ if ($aRow[0] == 0)
267
+ {
268
+ unset ( $aResult[$nKey] );
269
+ }
270
+ }
271
+ return $aResult;
272
+ }
273
+ */
274
+
275
+
276
+
277
+ public function createOrderListRequest($sStartTime = null, $sEndTime = null, array $aBeezupOrderStates = array(), array $aMarketPlaces = array()){
278
+ $helper = Mage::helper('beezup');
279
+ $oRequest = new BeezupOMOrderListRequest();
280
+ $oBeginPeriodUtcDate = new DateTime('now', new DateTimeZone('UTC'));
281
+ $nLastSynchro = ($sStartTime && strtotime($sStartTime)) ? strtotime($sStartTime) : (int)$helper->getConfig('beezup/marketplace/syncro_time');
282
+ if ($nLastSynchro){
283
+ $oBeginPeriodUtcDate->setTimestamp($nLastSynchro); // @todo Datetime::getTimestamp if PHP >5.3.0
284
+ }
285
+
286
+ $oEndPeriodUtcDate = new DateTime('now', new DateTimeZone('UTC'));
287
+ if ($sEndTime && strtotime($sEndTime)){
288
+ $oEndPeriodUtcDate->setTimestamp(strtotime($sEndTime));
289
+ }
290
+
291
+ $oRequest
292
+ ->setBeginPeriodUtcDate($oBeginPeriodUtcDate)
293
+ ->setEndPeriodUtcDate($oEndPeriodUtcDate);
294
+
295
+ if (!empty($aMarketPlaces)){
296
+ $oRequest->setMarketPlaceTechnicalCodes($aMarketPlaces);
297
+ }
298
+
299
+ if (!empty($aBeezupOrderStates)){
300
+ $oRequest->setBeezupOrderStates($aBeezupOrderStates);
301
+ }
302
+
303
+ return $oRequest;
304
+ }
305
+
306
+
307
+
308
+ public function getOrderList() {
309
+
310
+
311
+
312
+ }
313
+
314
+
315
+
316
+
317
+ }
app/code/community/BeezUp/lib/Common/BeezupOMCredential.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * BeezUP API credentials storage
5
+ */
6
+ class BeezupOMCredential {
7
+
8
+ /**
9
+ * BeezUP API token
10
+ * @var string
11
+ */
12
+ private $sBeezupApiToken = null;
13
+
14
+ /**
15
+ * Beezup User Id
16
+ * @var string
17
+ */
18
+ private $sBeezupUserId = null;
19
+
20
+ public function __construct($sBeezupUserId = null, $sBeezupApiToken = null){
21
+ $this
22
+ ->setBeezupApiToken($sBeezupApiToken)
23
+ ->setBeezupUserId($sBeezupUserId);
24
+ }
25
+
26
+ /**
27
+ * Returns BeezUP API token
28
+ * @return string
29
+ */
30
+ public function getBeezupApiToken(){
31
+ return $this->sBeezupApiToken;
32
+ }
33
+
34
+ /**
35
+ * Sets BeezUP API token
36
+ * @param string $sBeezupApiToken BeezUP API token
37
+ * @return BeezupOMCredential Self
38
+ */
39
+ public function setBeezupApiToken($sBeezupApiToken){
40
+ $this->sBeezupApiToken = (string)$sBeezupApiToken;
41
+ return $this;
42
+ }
43
+
44
+ /**
45
+ * Returns BeezUP API token
46
+ * @return string
47
+ */
48
+ public function getBeezupUserId(){
49
+ return $this->sBeezupUserId;
50
+ }
51
+
52
+ /**
53
+ * Sets BeezUP User Id
54
+ * @param string $sBeezupUserId BeezUP User Id
55
+ * @return BeezupOMCredential Self
56
+ */
57
+ public function setBeezupUserId($sBeezupUserId){
58
+ $this->sBeezupUserId = (string)$sBeezupUserId;
59
+ return $this;
60
+ }
61
+
62
+ }
app/code/community/BeezUp/lib/Common/BeezupOMErrorSummary.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMErrorSummary extends BeezupOMSummary {}
app/code/community/BeezUp/lib/Common/BeezupOMExpectedOrderChangeMetaInfo.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMExpectedOrderChangeMetaInfo {
4
+
5
+ protected $sCSharpType = null;
6
+ protected $bIsLOVRequired = false;
7
+ protected $bIsMandatory = false;
8
+ protected $oLovLink = null;
9
+ protected $sName = null;
10
+
11
+
12
+ /**
13
+ * @return the $sCode
14
+ */
15
+ public function getName()
16
+ {
17
+ return $this->sName;
18
+ }
19
+
20
+ /**
21
+ * @param NULL $sCode
22
+ */
23
+ public function setName($sName)
24
+ {
25
+ $this->sName = (string)$sName;
26
+ return $this;
27
+ }
28
+
29
+ /**
30
+ * @return the $sCSharpType
31
+ */
32
+ public function getCSharpType()
33
+ {
34
+ return $this->sCSharpType;
35
+ }
36
+
37
+ /**
38
+ * @param NULL $sCSharpType
39
+ */
40
+ public function setCSharpType($sCSharpType)
41
+ {
42
+ $this->sCSharpType = $sCSharpType;
43
+ return $this;
44
+ }
45
+
46
+ /**
47
+ * @return the $bIsLOVRequired
48
+ */
49
+ public function getIsLOVRequired()
50
+ {
51
+ return $this->bIsLOVRequired;
52
+ }
53
+
54
+ public function isLOVRequired()
55
+ {
56
+ return $this->bIsLOVRequired;
57
+ }
58
+
59
+ /**
60
+ * @param boolean $bIsLOVRequired
61
+ */
62
+ public function setIsLOVRequired($bIsLOVRequired)
63
+ {
64
+ $this->bIsLOVRequired = (boolean)$bIsLOVRequired;
65
+ }
66
+
67
+ /**
68
+ * @return the $bISMandatory
69
+ */
70
+ public function getIsMandatory()
71
+ {
72
+ return $this->bIsMandatory;
73
+ }
74
+
75
+ public function isMandatory()
76
+ {
77
+ return $this->bIsMandatory;
78
+ }
79
+ /**
80
+ * @param boolean $bISMandatory
81
+ */
82
+ public function setIsMandatory($bIsMandatory)
83
+ {
84
+ $this->bIsMandatory = (boolean)$bIsMandatory;
85
+ return $this;
86
+ }
87
+
88
+ /**
89
+ * @return the $oLovLink
90
+ */
91
+ public function getLovLink()
92
+ {
93
+ return $this->oLovLink;
94
+ }
95
+
96
+ /**
97
+ * @param NULL $oLovLink
98
+ */
99
+ public function setLovLink(BeezupOMLink $oLovLink)
100
+ {
101
+ $this->oLovLink = $oLovLink;
102
+ return $this;
103
+ }
104
+
105
+ public static function fromArray(array $aData = array()){
106
+ $oValue = new BeezupOMExpectedOrderChangeMetaInfo();
107
+ foreach ($aData as $sKey=>$mValue){
108
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
109
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
110
+ if (!method_exists($oValue,$sSetterMethod)){
111
+ continue;
112
+ }
113
+ $cCallback = array($oValue,$sSetterMethod);
114
+ if (strtolower($sKey)==='lovlink' && !is_null($mValue)){
115
+ call_user_func($cCallback, BeezupOMLink::fromArray($mValue));
116
+ } else if (is_scalar($mValue) && !is_null($mValue)){
117
+ call_user_func($cCallback, $mValue);
118
+ } // if
119
+ } // foreach
120
+ return $oValue;
121
+ }
122
+
123
+ public function toArray(){
124
+ return array(
125
+ "cSharpType" => $this->getCSharpType(),
126
+ "isMandatory" => $this->getIsMandatory(),
127
+ "islovRequired" => $this->getIsLOVRequired(),
128
+ "lovLink" => $this->getLovLink() ? $this->getLovLink()->toArray() : null,
129
+ "name" => $this->getName(),
130
+ );
131
+ }
132
+
133
+ }
app/code/community/BeezUp/lib/Common/BeezupOMInfoSummaries.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMInfoSummaries {
4
+
5
+ private static $aDefinitions = array(
6
+ 'errors' => array('name' => 'error', 'class' => 'BeezupOMErrorSummary'),
7
+ 'warnings' => array('name' => 'warning', 'class' => 'BeezupOMWarningSummary'),
8
+ 'informations' => array('name' => 'information', 'class' => 'BeezupOMInfoSummary'),
9
+ 'successes' => array('name' => 'success', 'class' => 'BeezupOMSuccessSummary'),
10
+ );
11
+
12
+ private $aErrors = array();
13
+ private $aWarnings = array();
14
+ private $aInformations = array();
15
+ private $aSuccesses = array();
16
+
17
+ public static function fromArray(array $aData = array()) {
18
+ $oInfo = new BeezupOMInfoSummaries();
19
+ return $oInfo->merge($aData);
20
+ }
21
+
22
+ public function toArray() {
23
+ $aResult = array(
24
+ 'errors' => $this->getErrors(),
25
+ 'warnings' => $this->getWarnings(),
26
+ 'informations' => $this->getInformations(),
27
+ 'successes' => $this->getSuccesses(),
28
+ );
29
+ foreach ($aResult as $sType => $aList){
30
+ foreach ($aList as $nIndex=>$oItem){
31
+ $aResult[$sType][$nIndex] = $oItem->toArray();
32
+ }
33
+ }
34
+ return $aResult;
35
+
36
+ }
37
+
38
+ public function merge(array $aData = array()) {
39
+ foreach (self::$aDefinitions as $sProperty => $aDefinition) {
40
+ if (!isset($aData[$sProperty])){
41
+ continue;
42
+ } // if
43
+ $sClassName = $aDefinition['class'];
44
+ $sCodePropertyName = $aDefinition['name'] . 'Code';
45
+ $sMessagePropertyName = $aDefinition['name'] . 'Message';
46
+ $cAddCallback = array($this, 'add' . ucfirst($aDefinition['name']));
47
+
48
+ foreach ($aData[$sProperty] as $mAtom){
49
+
50
+ if (is_object($mAtom) && $mAtom instanceof BeezupOMSummary){
51
+ $oAtom = $mAtom;
52
+ } else if (is_array($mAtom)){
53
+ $aAtom = $mAtom;
54
+
55
+ if (array_key_exists('code', $aAtom)){
56
+ $oAtom = call_user_func(array($sClassName, 'fromArray'), $aAtom);
57
+ } else if (array_key_exists($sCodePropertyName, $aAtom) && array_key_exists($sMessagePropertyName, $aAtom)){
58
+ $oAtom = new $sClassName((string)$aAtom[$sCodePropertyName], (string)$aAtom[$sMessagePropertyName]);
59
+ }
60
+ } else {
61
+ continue;
62
+ }
63
+ if ($oAtom){
64
+ call_user_func($cAddCallback, $oAtom);
65
+ }
66
+ } // foreach
67
+ } // foreach
68
+ return $this;
69
+ }
70
+
71
+ public function getErrors(){
72
+ return $this->aErrors;
73
+ }
74
+
75
+ public function addError(BeezupOMSummary $oAtom){
76
+ $this->aErrors[] = $oAtom;
77
+ return $this;
78
+
79
+ }
80
+
81
+ public function getWarnings(){
82
+ return $this->aWarnings;
83
+ }
84
+
85
+ public function addWarning(BeezupOMSummary $oAtom){
86
+ $this->aWarnings[] = $oAtom;
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @return array:
93
+ */
94
+ public function getInformations(){
95
+ return $this->aInformations;
96
+ }
97
+
98
+ public function addInformation(BeezupOMSummary $oAtom){
99
+ $this->aInformations[] = $oAtom;
100
+ return $this;
101
+ }
102
+
103
+ public function getSuccesses(){
104
+ return $this->aSuccesses;
105
+ }
106
+
107
+ public function addSuccess(BeezupOMSummary $oAtom){
108
+ $this->aSuccesses[] = $oAtom;
109
+ return $this;
110
+ }
111
+ }
app/code/community/BeezUp/lib/Common/BeezupOMInfoSummary.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMInfoSummary extends BeezupOMSummary {}
app/code/community/BeezUp/lib/Common/BeezupOMLink.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMLink {
4
+
5
+ private $aHeaders = array();
6
+ private $sHref = null;
7
+ private $oInfo = null;
8
+ private $sMethod = 'GET';
9
+ private $sRel = null;
10
+ private $aParameters = array();
11
+
12
+ public static function fromArray(array $aData = array()){
13
+
14
+ $oLink = new BeezupOMLink();
15
+
16
+ $aData = array_combine(array_map('strtolower', array_keys($aData)), array_values($aData));
17
+
18
+ $oLink
19
+ ->setRel($aData['rel'])
20
+ ->setHref($aData['href'])
21
+ ->setMethod($aData['method'])
22
+ ->setHeaders((array)$aData['headers']);
23
+
24
+ if (isset($aData['info'])){
25
+
26
+ $oLink->setInfo(BeezupOMInfoSummaries::fromArray($aData['info']));
27
+
28
+ }
29
+
30
+ if (isset($aData['parameters']) && is_array($aData['parameters'])){
31
+ foreach ($aData['parameters'] as $aParameter){
32
+ $oLink->addParameter(BeezupOMExpectedOrderChangeMetaInfo::fromArray($aParameter));
33
+ }
34
+ }
35
+
36
+ return $oLink;
37
+
38
+ }
39
+
40
+ public function __toString(){
41
+ return $this->getHref();
42
+ }
43
+
44
+
45
+ public function toArray(){
46
+
47
+ return array(
48
+ 'rel' => $this->getRel(),
49
+ 'href' => $this->getHref(),
50
+ 'method' => $this->getMethod(),
51
+ 'headers' => $this->getHeaders(),
52
+ 'parameters'=> $this->getParametersAsArrays()
53
+ );
54
+
55
+ }
56
+
57
+ /**
58
+ * @return the $aHeaders
59
+ */
60
+ public function getHeaders()
61
+ {
62
+ return $this->aHeaders;
63
+ }
64
+
65
+ /**
66
+ * @param multitype: $aHeaders
67
+ */
68
+ public function setHeaders($aHeaders)
69
+ {
70
+ $this->aHeaders = $aHeaders;
71
+ return $this;
72
+
73
+ }
74
+
75
+ public function addHeader($sHeader){
76
+ $this->aHeaders[] = $sHeader;
77
+ }
78
+
79
+ /**
80
+ * @return the $sHref
81
+ */
82
+ public function getHref()
83
+ {
84
+ return $this->sHref;
85
+ }
86
+
87
+ /**
88
+ * @param NULL $sHref
89
+ */
90
+ public function setHref($sHref)
91
+ {
92
+ $this->sHref = $sHref;
93
+ return $this;
94
+
95
+ }
96
+
97
+ /**
98
+ * @return the $oInfo
99
+ */
100
+ public function getInfo()
101
+ {
102
+ return $this->oInfo;
103
+ }
104
+
105
+ /**
106
+ * @param NULL $oInfo
107
+ */
108
+ public function setInfo($oInfo)
109
+ {
110
+ $this->oInfo = $oInfo;
111
+ return $this;
112
+
113
+ }
114
+
115
+ /**
116
+ * @return the $sMethod
117
+ */
118
+ public function getMethod()
119
+ {
120
+ return $this->sMethod;
121
+ }
122
+
123
+ /**
124
+ * @param string $sMethod
125
+ */
126
+ public function setMethod($sMethod)
127
+ {
128
+ $this->sMethod = $sMethod;
129
+ return $this;
130
+
131
+ }
132
+
133
+ /**
134
+ * @return the $sRel
135
+ */
136
+ public function getRel()
137
+ {
138
+ return $this->sRel;
139
+ }
140
+
141
+ /**
142
+ * @param NULL $sRel
143
+ */
144
+ public function setRel($sRel)
145
+ {
146
+ $this->sRel = $sRel;
147
+ return $this;
148
+
149
+ }
150
+
151
+ /**
152
+ * @return the $aValues
153
+ */
154
+ public function getParameters()
155
+ {
156
+ return $this->aParameters;
157
+ }
158
+
159
+ public function getParametersAsArrays()
160
+ {
161
+ $aResult = array();
162
+ foreach ($this->aParameters as $oParameter){
163
+ $aResult[] = $oParameter->toArray();
164
+ }
165
+ return $aResult;
166
+ }
167
+
168
+ /**
169
+ * @param multitype: $aValues
170
+ */
171
+ public function setParameters($aParameters)
172
+ {
173
+ $this->aParameters = $aParameters;
174
+ return $this;
175
+ }
176
+
177
+ public function addParameter(BeezupOMExpectedOrderChangeMetaInfo $oParameter){
178
+
179
+ $this->aParameters[] = $oParameter;
180
+ return $this;
181
+ }
182
+
183
+ }
app/code/community/BeezUp/lib/Common/BeezupOMOrderIdentifier.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Beezup order identifier
5
+ * @todo Add variables validation
6
+ */
7
+ class BeezupOMOrderIdentifier {
8
+
9
+ # PROTECTED VARIABLES
10
+
11
+ /**
12
+ * For example "Amazon" or "CDiscount"
13
+ * @var string
14
+ */
15
+ protected $sMarketplaceTechnicalCode = '';
16
+
17
+ /**
18
+ * Account id, for example "1234"
19
+ * @var string Numeric string
20
+ */
21
+ protected $sAccountId = '';
22
+
23
+ /**
24
+ * Unique order id, for example "8D1DE1CE0BCC5AB98758345fbd14f95a6e17431458ecdd6"
25
+ * @var string 47 characters
26
+ */
27
+ protected $sBeezupOrderUUID = '';
28
+
29
+ # STATIC METHODS
30
+
31
+ /**
32
+ * Creates identifier object from Beezup order
33
+ * @param BeezupOMOrderResult $oBeezupOrder
34
+ * @return BeezupOMOrderIdentifier New identifier
35
+ */
36
+ public static function fromBeezupOrder(BeezupOMOrderResult $oBeezupOrder){
37
+ $oResult = new self();
38
+ return $oResult
39
+ ->setMarketplaceTechnicalCode($oBeezupOrder->getMarketPlaceTechnicalCode())
40
+ ->setAccountId($oBeezupOrder->getAccountId())
41
+ ->setBeezupOrderUUID($oBeezupOrder->getBeezupOrderUUID());
42
+ $oResult;
43
+ } // fromBeezupOrder
44
+
45
+ public static function fromBeezupOrderLink(BeezupOMLink $oLink){
46
+ $oResult = new self();
47
+ $aData = explode('/', $oLink->getHref());
48
+ if (count($aData) >= 6 && is_numeric($aData[4])){
49
+ return $oResult
50
+ ->setMarketplaceTechnicalCode($aData[3])
51
+ ->setAccountId($aData[4])
52
+ ->setBeezupOrderUUID($aData[5]);
53
+ } else {
54
+ throw new Exception(sprintf('Unable to convert %s into order id', $oLink->getHref()));
55
+ }
56
+ return $oResult;
57
+ } // fromBeezupOrder
58
+
59
+ /**
60
+ * Creates identifier object from array
61
+ * @param array $aData Should contain 3 keys: accountid, beezuporderuuid and marketplacetechnicalcode (key casing is insensitive)
62
+ * @throws InvalidArgumentException When array do not contain all required keys (values can be empty, though)
63
+ * @return BeezupOMOrderIdentifier New identifier
64
+ */
65
+ public static function fromArray(array $aData = array()){
66
+ $aData = array_change_key_case($aData, CASE_LOWER);
67
+ if (!array_key_exists('accountid', $aData) || !array_key_exists('beezuporderuuid', $aData) || !array_key_exists('marketplacetechnicalcode', $aData)){
68
+ $sErrorMessage = 'Array should have accountid, beezuporderuuid and marketplacetechnicalcode keys, ' . (count($aData) ? implode(' ,', array_keys($aData)) : ' no key') . ' given';
69
+ throw new InvalidArgumentException($sErrorMessage);
70
+ }
71
+ $oResult = new BeezupOMOrderIdentifier();
72
+ $oResult
73
+ ->setMarketplaceTechnicalCode($aData['marketplacetechnicalcode'])
74
+ ->setAccountId($aData['accountid'])
75
+ ->setBeezupOrderUUID($aData['beezuporderuuid']);
76
+ return $oResult;
77
+ } // fromArray
78
+
79
+ # MAGIC METHODS
80
+
81
+ /**
82
+ * Return order identifier as string
83
+ * @return string
84
+ */
85
+ public function __toString(){
86
+ return $this->getMarketplaceTechnicalCode() . '/' . $this->getAccountId() . '/' . $this->getBeezupOrderUUID();
87
+ } // __toString
88
+
89
+ # PUBLIC METHODS
90
+
91
+ /**
92
+ * Returns order identifier as array
93
+ * @return array of <string:key => string:value>
94
+ */
95
+ public function toArray(){
96
+ return array(
97
+ 'MarketPlaceTechnicalCode' => $this->getMarketplaceTechnicalCode(),
98
+ 'AccountId' => $this->getAccountId(),
99
+ 'BeezUPOrderUUID' => $this->getBeezupOrderUUID()
100
+ );
101
+ } // toArray
102
+
103
+ # SETTERS & GETTERS
104
+
105
+ /**
106
+ * Sets marketplace technical code
107
+ * @param string $sMarketplaceTechnicalCode
108
+ * @return BeezupOMOrderIdentifier
109
+ */
110
+ public function setMarketplaceTechnicalCode($sMarketplaceTechnicalCode){
111
+ $this->sMarketplaceTechnicalCode = (string)$sMarketplaceTechnicalCode;
112
+ return $this;
113
+ } // setMarketplaceTechnicalCode
114
+
115
+ /**
116
+ * Gets marketplace technical code
117
+ * @return string marketplace technical code
118
+ */
119
+ public function getMarketplaceTechnicalCode(){
120
+ return $this->sMarketplaceTechnicalCode;
121
+ } // getMarketplaceTechnicalCode
122
+
123
+ /**
124
+ * Gets account id
125
+ * @param string $sAccountId
126
+ * @return BeezupOMOrderIdentifier Self
127
+ */
128
+ public function setAccountId($sAccountId){
129
+ $this->sAccountId = (string)$sAccountId;
130
+ return $this;
131
+ } // setAccountId
132
+
133
+ /**
134
+ * Sets account id
135
+ * @return string
136
+ */
137
+ public function getAccountId(){
138
+ return $this->sAccountId;
139
+ } // getAccountId
140
+
141
+ /**
142
+ * Sets unique order id
143
+ * @param string $sBeezupOrderUUID
144
+ * @return BeezupOMOrderIdentifier
145
+ */
146
+ public function setBeezupOrderUUID($sBeezupOrderUUID){
147
+ $this->sBeezupOrderUUID = (string)$sBeezupOrderUUID;
148
+ return $this;
149
+ } // setBeezupOrderUUID
150
+
151
+ /**
152
+ * Gets unique order id
153
+ * @return string
154
+ */
155
+ public function getBeezupOrderUUID(){
156
+ return $this->sBeezupOrderUUID;
157
+ } // getBeezupOrderUUID
158
+
159
+ }
app/code/community/BeezUp/lib/Common/BeezupOMProcessingStatus.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMProcessingStatus {
4
+ const IN_PROGRESS = 'IN_PROGRESS';
5
+ const FAILED = 'FAILED';
6
+ const SUCCEED = 'SUCCEED';
7
+ const ABORTED = 'ABORTED';
8
+ const TIMEOUT = 'TIMEOUT';
9
+ }
10
+
app/code/community/BeezUp/lib/Common/BeezupOMRequest.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMRequest {
4
+
5
+ const METHOD_GET = 'GET';
6
+ const METHOD_POST = 'POST';
7
+ const METHOD_PATCH = 'PATCH';
8
+
9
+ protected $sMethod = self::METHOD_GET;
10
+
11
+ protected $sDateFormat = 'Y-m-d\TH:i:s\Z';//DateTime::ISO8601;
12
+
13
+ public function getMethod(){
14
+ return $this->sMethod;
15
+ }
16
+ public function setMethod($sMethod){
17
+ if (in_array($sMethod, array(self::METHOD_GET, self::METHOD_POST))){
18
+ $this->sMethod = $sMethod;
19
+ }
20
+ return $this;
21
+ }
22
+ public static function fromArray(array $aData = array()){
23
+ $oRequest = new BeezupOMRequest();
24
+ foreach ($aData as $sKey => $mValue){
25
+ $oRequest->$sKey = $mValue;
26
+ }
27
+ return $oRequest;
28
+ }
29
+ public function toArray(){
30
+ return array();
31
+ }
32
+
33
+ }
app/code/community/BeezUp/lib/Common/BeezupOMResponse.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMResponse {
4
+
5
+ protected $oRequest;
6
+ protected $oResult;
7
+ protected $oInfo;
8
+ protected $bNotModified = false;
9
+ protected $nHttpStatus = null;
10
+ protected $aReturnHeaders = array();
11
+
12
+ public function setReturnHeaders(array $aReturnHeaders = array()){
13
+ $this->aReturnHeaders = $aReturnHeaders;
14
+ return $this;
15
+
16
+ }
17
+ public function getReturnHeaders(){
18
+ return $this->aReturnHeaders;
19
+
20
+ }
21
+
22
+ public function getReturnHeader($sName){
23
+ return isset($this->aReturnHeaders[$sName]) ? $this->aReturnHeaders[$sName] : null;
24
+ }
25
+
26
+ public function isNotModified()
27
+ {
28
+ return $this->getNotModified();
29
+ }
30
+
31
+ public function isModified()
32
+ {
33
+ return !$this->isNotModified();
34
+ }
35
+
36
+ /**
37
+ * @return the $bNotModified
38
+ */
39
+ public function getNotModified()
40
+ {
41
+ return $this->bNotModified;
42
+ }
43
+
44
+ /**
45
+ * @param boolean $bNotModified
46
+ */
47
+ public function setNotModified($bNotModified)
48
+ {
49
+ $this->bNotModified = (boolean)$bNotModified;
50
+ return $this;
51
+ }
52
+
53
+ public function getRequest(){
54
+ return $this->oRequest;
55
+ }
56
+ public function setRequest(BeezupOMRequest $oRequest){
57
+ $this->oRequest = $oRequest;
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @return BeezupOMResult
64
+ */
65
+ public function getResult(){
66
+ return $this->oResult;
67
+ }
68
+ public function setResult(BeezupOMResult $oResult){
69
+ $this->oResult = $oResult;
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ * @return BeezupOMInfoSummaries
75
+ */
76
+ public function getInfo(){
77
+ return $this->oInfo;
78
+ }
79
+ public function setInfo(BeezupOMInfoSummaries $oInfo){
80
+ $this->oInfo = $oInfo;
81
+ return $this;
82
+ }
83
+ public function getHttpStatus(){
84
+ return $this->nHttpStatus;
85
+ }
86
+ public function setHttpStatus($nHttpStatus){
87
+ $this->nHttpStatus = (int)$nHttpStatus;
88
+ return $this;
89
+ }
90
+
91
+ public function parseRawResponse($aParsedResponse){
92
+
93
+ }
94
+
95
+ public static function fromArray(array $aData = array()){
96
+ return new BeezupOMResponse();
97
+ }
98
+
99
+ public function createResult(array $aData = array()){
100
+ return BeezupOMResult::fromArray($aData);
101
+ }
102
+ public function createRequest(array $aData = array()){
103
+ return BeezupOMRequest::fromArray($aData);
104
+ }
105
+ }
app/code/community/BeezUp/lib/Common/BeezupOMResult.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class BeezupOMResult extends BeezupOMDataHandler {
3
+
4
+ public function __call($sMethod, $aArgs) {
5
+ throw new BadMethodCallException(sprintf('Unimplemented method %s::%s', get_class($this), $sMethod));
6
+ }
7
+ }
app/code/community/BeezUp/lib/Common/BeezupOMSuccessSummary.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMSuccessSummary extends BeezupOMSummary {}
app/code/community/BeezUp/lib/Common/BeezupOMSummary.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class BeezupOMSummary {
4
+ private $sCode = null;
5
+ private $sMessage = null;
6
+ public function __construct($sCode = '', $sMessage = ''){
7
+ $this->sCode = (string)$sCode;
8
+ $this->sMessage = (string)$sMessage;
9
+ }
10
+ public function getCode(){
11
+ return $this->sCode;
12
+ }
13
+ public function getMessage(){
14
+ return $this->sMessage;
15
+ }
16
+ public function setCode($sCode){
17
+ $this->sCode = $sCode;
18
+ return $this;
19
+ }
20
+ public function setMessage($sMessage){
21
+ $this->sMessage = $sMessage;
22
+ return $this;
23
+ }
24
+ public function toArray(){
25
+ return array(
26
+ 'code' => $this->getCode(),
27
+ 'message' => $this->getMessage()
28
+ );
29
+ }
30
+ public static function fromArray(array $aData = array()){
31
+ // @todo PHP < 5.3
32
+ $oResult = new static();
33
+ if (isset($aData['code'])){
34
+ $oResult->setCode($aData['code']);
35
+ }
36
+ if (isset($aData['message'])){
37
+ $oResult->setMessage($aData['message']);
38
+ }
39
+ return $oResult;
40
+ }
41
+ }
app/code/community/BeezUp/lib/Common/BeezupOMWarningSummary.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMWarningSummary extends BeezupOMSummary {}
app/code/community/BeezUp/lib/Harvest/BeezupOMHarvestAbstractReporting.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMHarvestAbstractReporting extends BeezupOMDataHandler {}
app/code/community/BeezUp/lib/Harvest/BeezupOMHarvestClientReporting.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMHarvestClientReporting extends BeezupOMHarvestAbstractReporting {
4
+
5
+ protected $sExecutionId = null;
6
+ protected $oCreationUtcDate = null;
7
+ protected $oLastUpdateUtcDate = null;
8
+ protected $sErrorMessage = null;
9
+ protected $nTotalOrderCount = null;
10
+ protected $sProcessingStatus = null;
11
+ protected $oBeginPeriodUtcDate = null;
12
+ protected $oEndPeriodUtcDate = null;
13
+ protected $nEntriesPerPage = null;
14
+ protected $sBeezUPApiToken = null;
15
+ protected $sBeezUPUserId = null;
16
+ /**
17
+ * @todo verify name in API
18
+ * @var unknown_type
19
+ */
20
+ protected $nRemainingPageCount = null;
21
+
22
+ /**
23
+ * @return the $sExecutionId
24
+ */
25
+ public function getExecutionId()
26
+ {
27
+ return $this->sExecutionId;
28
+ }
29
+
30
+ /**
31
+ * @param NULL $sExecutionId
32
+ */
33
+ public function setExecutionId($sExecutionId)
34
+ {
35
+ $this->sExecutionId = $sExecutionId;
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * @return the $oCreationUtcDate
41
+ */
42
+ public function getCreationUtcDate()
43
+ {
44
+ return $this->oCreationUtcDate;
45
+ }
46
+
47
+ /**
48
+ * @param NULL $oCreationUtcDate
49
+ */
50
+ public function setCreationUtcDate($oCreationUtcDate)
51
+ {
52
+ $this->oCreationUtcDate = $oCreationUtcDate;
53
+ return $this;
54
+
55
+ }
56
+
57
+ /**
58
+ * @return the $oLastUpdateUtcDate
59
+ */
60
+ public function getLastUpdateUtcDate()
61
+ {
62
+ return $this->oLastUpdateUtcDate;
63
+
64
+ }
65
+
66
+ /**
67
+ * @param NULL $oLastUpdateUtcDate
68
+ */
69
+ public function setLastUpdateUtcDate($oLastUpdateUtcDate)
70
+ {
71
+ $this->oLastUpdateUtcDate = $oLastUpdateUtcDate;
72
+ return $this;
73
+
74
+ }
75
+
76
+ /**
77
+ * @return the $oErrorMessage
78
+ */
79
+ public function getErrorMessage()
80
+ {
81
+ return $this->sErrorMessage;
82
+ }
83
+
84
+ /**
85
+ * @param NULL $oErrorMessage
86
+ */
87
+ public function setErrorMessage($sErrorMessage)
88
+ {
89
+ $this->sErrorMessage = substr($this->sErrorMessage === null ? $sErrorMessage : $this->sErrorMessage . PHP_EOL . $sErrorMessage, 0, 4090);
90
+ return $this;
91
+
92
+ }
93
+
94
+ /**
95
+ * @return the $nTotalOrderCount
96
+ */
97
+ public function getTotalOrderCount()
98
+ {
99
+ return $this->nTotalOrderCount;
100
+ }
101
+
102
+ /**
103
+ * @param NULL $nTotalOrderCount
104
+ */
105
+ public function setTotalOrderCount($nTotalOrderCount)
106
+ {
107
+ $this->nTotalOrderCount = $nTotalOrderCount;
108
+ return $this;
109
+
110
+ }
111
+
112
+ /**
113
+ * @return the $sProcessingStatus
114
+ */
115
+ public function getProcessingStatus()
116
+ {
117
+ return $this->sProcessingStatus;
118
+ }
119
+
120
+ /**
121
+ * @param NULL $oProcessingStatus
122
+ */
123
+ public function setProcessingStatus($sProcessingStatus)
124
+ {
125
+ $this->sProcessingStatus = $sProcessingStatus;
126
+ return $this;
127
+
128
+ }
129
+
130
+ /**
131
+ * @return the $oBeginPeriodUtcDate
132
+ */
133
+ public function getBeginPeriodUtcDate()
134
+ {
135
+ return $this->oBeginPeriodUtcDate;
136
+ }
137
+
138
+ /**
139
+ * @param NULL $oBeginPeriodUtcDate
140
+ */
141
+ public function setBeginPeriodUtcDate($oBeginPeriodUtcDate)
142
+ {
143
+ $this->oBeginPeriodUtcDate = $oBeginPeriodUtcDate;
144
+ return $this;
145
+
146
+ }
147
+
148
+ /**
149
+ * @return the $oEndPeriodUtcDate
150
+ */
151
+ public function getEndPeriodUtcDate()
152
+ {
153
+ return $this->oEndPeriodUtcDate;
154
+ }
155
+
156
+ /**
157
+ * @param NULL $oEndPeriodUtcDate
158
+ */
159
+ public function setEndPeriodUtcDate($oEndPeriodUtcDate)
160
+ {
161
+ $this->oEndPeriodUtcDate = $oEndPeriodUtcDate;
162
+ return $this;
163
+
164
+ }
165
+
166
+ /**
167
+ * @return the $nEntriesPerPage
168
+ */
169
+ public function getEntriesPerPage()
170
+ {
171
+ return $this->nEntriesPerPage;
172
+ }
173
+
174
+ /**
175
+ * @param NULL $nEntriesPerPage
176
+ */
177
+ public function setEntriesPerPage($nEntriesPerPage)
178
+ {
179
+ $this->nEntriesPerPage = $nEntriesPerPage;
180
+ return $this;
181
+
182
+ }
183
+
184
+ /**
185
+ * @return the $sBeezUPApiToken
186
+ */
187
+ public function getBeezUPApiToken()
188
+ {
189
+ return $this->sBeezUPApiToken;
190
+ }
191
+
192
+ /**
193
+ * @param NULL $sBeezUPApiToken
194
+ */
195
+ public function setBeezUPApiToken($sBeezUPApiToken)
196
+ {
197
+ $this->sBeezUPApiToken = $sBeezUPApiToken;
198
+ return $this;
199
+
200
+ }
201
+
202
+ /**
203
+ * @return the $sBeezUPUserId
204
+ */
205
+ public function getBeezUPUserId()
206
+ {
207
+ return $this->sBeezUPUserId;
208
+ }
209
+
210
+ /**
211
+ * @param NULL $sBeezUPUserId
212
+ */
213
+ public function setBeezUPUserId($sBeezUPUserId)
214
+ {
215
+ $this->sBeezUPUserId = $sBeezUPUserId;
216
+ return $this;
217
+
218
+ }
219
+
220
+ /**
221
+ * @return the $nRemainingPageCount
222
+ */
223
+ public function getRemainingPageCount()
224
+ {
225
+ return $this->nRemainingPageCount;
226
+ }
227
+
228
+ /**
229
+ * @param NULL $nRemainingPageCount
230
+ */
231
+ public function setRemainingPageCount($nRemainingPageCount)
232
+ {
233
+ $this->nRemainingPageCount = max(0, (int)$nRemainingPageCount);
234
+ return $this;
235
+
236
+ }
237
+
238
+
239
+ }
app/code/community/BeezUp/lib/Harvest/BeezupOMHarvestOrderReporting.php ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMHarvestOrderReporting extends BeezupOMHarvestAbstractReporting {
4
+
5
+ protected $sExecutionId = null;
6
+ protected $oCreationUtcDate = null;
7
+ protected $oLastUpdateUtcDate = null;
8
+ protected $sErrorMessage = null;
9
+ protected $sProcessingStatus = null;
10
+ protected $sBeezUPApiToken = null;
11
+ protected $sBeezUPUserId = null;
12
+
13
+ protected $sAccountId = null;
14
+ protected $sBeezupOrderUUID = null;
15
+ protected $sEtag = null;
16
+ protected $sMarketPlaceTechnicalCode = null;
17
+ protected $sHttpStatus = null;
18
+ protected $sParentExecutionUUID = null;
19
+ protected $sOrderDetailJson = null;
20
+ protected $oLastModificationUtcDate = null;
21
+
22
+
23
+ /**
24
+ * @return $nAccountId
25
+ */
26
+ public function getAccountId()
27
+ {
28
+ return $this->sAccountId;
29
+ }
30
+
31
+ /**
32
+ * @param NULL $nAccountId
33
+ * @return BeezupOMrderHarvestClientReporting
34
+ */
35
+ public function setAccountId($sAccountId)
36
+ {
37
+ $this->sAccountId = $sAccountId;
38
+ return $this;
39
+ }
40
+
41
+ /**
42
+ * @return $sBeezupOrderUUID
43
+ */
44
+ public function getBeezupOrderUUID()
45
+ {
46
+ return $this->sBeezupOrderUUID;
47
+ }
48
+
49
+ /**
50
+ * @param NULL $sBeezupOrderUUID
51
+ * @return BeezupOMrderHarvestClientReporting
52
+ */
53
+ public function setBeezupOrderUUID($sBeezupOrderUUID)
54
+ {
55
+ $this->sBeezupOrderUUID = $sBeezupOrderUUID;
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * @return $sEtag
61
+ */
62
+ public function getEtag()
63
+ {
64
+ return $this->sEtag;
65
+ }
66
+
67
+ /**
68
+ * @param NULL $sEtag
69
+ * @return BeezupOMrderHarvestClientReporting
70
+ */
71
+ public function setEtag($sEtag)
72
+ {
73
+ $this->sEtag = $sEtag;
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * @return $sMarketPlaceTechnicalCode
79
+ */
80
+ public function getMarketPlaceTechnicalCode()
81
+ {
82
+ return $this->sMarketPlaceTechnicalCode;
83
+ }
84
+
85
+ /**
86
+ * @param NULL $sMarketPlaceTechnicalCode
87
+ * @return BeezupOMrderHarvestClientReporting
88
+ */
89
+ public function setMarketPlaceTechnicalCode($sMarketPlaceTechnicalCode)
90
+ {
91
+ $this->sMarketPlaceTechnicalCode = $sMarketPlaceTechnicalCode;
92
+ return $this;
93
+ }
94
+
95
+ /**
96
+ * @return $sHttpStatus
97
+ */
98
+ public function getHttpStatus()
99
+ {
100
+ return $this->sHttpStatus;
101
+ }
102
+
103
+ /**
104
+ * @param NULL $sHttpStatus
105
+ * @return BeezupOMrderHarvestClientReporting
106
+ */
107
+ public function setHttpStatus($sHttpStatus)
108
+ {
109
+ $this->sHttpStatus = $sHttpStatus;
110
+ return $this;
111
+ }
112
+
113
+ /**
114
+ * @return $sParentExecutionUUID
115
+ */
116
+ public function getParentExecutionUUID()
117
+ {
118
+ return $this->sParentExecutionUUID;
119
+ }
120
+
121
+ /**
122
+ * @param NULL $sParentExecutionUUID
123
+ * @return BeezupOMrderHarvestClientReporting
124
+ */
125
+ public function setParentExecutionUUID($sParentExecutionUUID)
126
+ {
127
+ $this->sParentExecutionUUID = $sParentExecutionUUID;
128
+ return $this;
129
+ }
130
+
131
+ /**
132
+ * @return $sOrderDetailJson
133
+ */
134
+ public function getOrderDetailJson()
135
+ {
136
+ return $this->sOrderDetailJson;
137
+ }
138
+
139
+ /**
140
+ * @param NULL $sOrderDetailJson
141
+ * @return BeezupOMrderHarvestClientReporting
142
+ */
143
+ public function setOrderDetailJson($sOrderDetailJson)
144
+ {
145
+ $this->sOrderDetailJson = $sOrderDetailJson;
146
+ return $this;
147
+ }
148
+
149
+ /**
150
+ * @return $oLastModificationUtcDate
151
+ */
152
+ public function getLastModificationUtcDate()
153
+ {
154
+ return $this->oLastModificationUtcDate;
155
+ }
156
+
157
+ /**
158
+ * @param NULL $oLastModificationUtcDate
159
+ * @return BeezupOMrderHarvestClientReporting
160
+ */
161
+ public function setLastModificationUtcDate($oLastModificationUtcDate)
162
+ {
163
+ $this->oLastModificationUtcDate = $oLastModificationUtcDate;
164
+ return $this;
165
+ }
166
+
167
+ /**
168
+ * @return the $sExecutionId
169
+ */
170
+ public function getExecutionId()
171
+ {
172
+ return $this->sExecutionId;
173
+ }
174
+
175
+ /**
176
+ * @param NULL $sExecutionId
177
+ */
178
+ public function setExecutionId($sExecutionId)
179
+ {
180
+ $this->sExecutionId = $sExecutionId;
181
+ return $this;
182
+ }
183
+
184
+ /**
185
+ * @return the $oCreationUtcDate
186
+ */
187
+ public function getCreationUtcDate()
188
+ {
189
+ return $this->oCreationUtcDate;
190
+ }
191
+
192
+ /**
193
+ * @param NULL $oCreationUtcDate
194
+ */
195
+ public function setCreationUtcDate($oCreationUtcDate)
196
+ {
197
+ $this->oCreationUtcDate = $oCreationUtcDate;
198
+ return $this;
199
+ }
200
+
201
+ /**
202
+ * @return the $oLastUpdateUtcDate
203
+ */
204
+ public function getLastUpdateUtcDate()
205
+ {
206
+ return $this->oLastUpdateUtcDate;
207
+ }
208
+
209
+ /**
210
+ * @param NULL $oLastUpdateUtcDate
211
+ */
212
+ public function setLastUpdateUtcDate($oLastUpdateUtcDate)
213
+ {
214
+ $this->oLastUpdateUtcDate = $oLastUpdateUtcDate;
215
+ return $this;
216
+
217
+ }
218
+
219
+ /**
220
+ * @return the $oErrorMessage
221
+ */
222
+ public function getErrorMessage()
223
+ {
224
+ return $this->sErrorMessage;
225
+ }
226
+
227
+ /**
228
+ * @param NULL $oErrorMessage
229
+ */
230
+ public function setErrorMessage($sErrorMessage)
231
+ {
232
+ $this->sErrorMessage = substr($this->sErrorMessage === null ? $sErrorMessage : $this->sErrorMessage . PHP_EOL . $sErrorMessage, 0, 4090);
233
+ return $this;
234
+
235
+ }
236
+
237
+ /**
238
+ * @return the $sProcessingStatus
239
+ */
240
+ public function getProcessingStatus()
241
+ {
242
+ return $this->sProcessingStatus;
243
+ }
244
+
245
+ /**
246
+ * @param NULL $oProcessingStatus
247
+ */
248
+ public function setProcessingStatus($sProcessingStatus)
249
+ {
250
+ $this->sProcessingStatus = $sProcessingStatus;
251
+ return $this;
252
+ }
253
+
254
+ /**
255
+ * @return the $sBeezUPApiToken
256
+ */
257
+ public function getBeezUPApiToken()
258
+ {
259
+ return $this->sBeezUPApiToken;
260
+ }
261
+
262
+ /**
263
+ * @param NULL $sBeezUPApiToken
264
+ */
265
+ public function setBeezUPApiToken($sBeezUPApiToken)
266
+ {
267
+ $this->sBeezUPApiToken = $sBeezUPApiToken;
268
+ return $this;
269
+
270
+ }
271
+
272
+ /**
273
+ * @return the $sBeezUPUserId
274
+ */
275
+ public function getBeezUPUserId()
276
+ {
277
+ return $this->sBeezUPUserId;
278
+ }
279
+
280
+ /**
281
+ * @param NULL $sBeezUPUserId
282
+ */
283
+ public function setBeezUPUserId($sBeezUPUserId)
284
+ {
285
+ $this->sBeezUPUserId = $sBeezUPUserId;
286
+ return $this;
287
+
288
+ }
289
+
290
+
291
+ }
app/code/community/BeezUp/lib/KLogger.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Finally, A light, permissions-checking logging class.
4
+ *
5
+ * Author : Kenneth Katzgrau < katzgrau@gmail.com >
6
+ * Date : July 26, 2008
7
+ * Comments : Originally written for use with wpSearch
8
+ * Website : http://codefury.net
9
+ * Version : 1.0
10
+ *
11
+ * Usage:
12
+ * $log = new KLogger ( "log.txt" , KLogger::INFO );
13
+ * $log->LogInfo("Returned a million search results"); //Prints to the log file
14
+ * $log->LogFATAL("Oh dear."); //Prints to the log file
15
+ * $log->LogDebug("x = 5"); //Prints nothing due to priority setting
16
+ */
17
+
18
+ class KLogger
19
+ {
20
+
21
+ const DEBUG = 1; // Most Verbose
22
+ const INFO = 2; // ...
23
+ const WARN = 3; // ...
24
+ const ERROR = 4; // ...
25
+ const FATAL = 5; // Least Verbose
26
+ const OFF = 6; // Nothing at all.
27
+
28
+ const LOG_OPEN = 1;
29
+ const OPEN_FAILED = 2;
30
+ const LOG_CLOSED = 3;
31
+
32
+ /* Public members: Not so much of an example of encapsulation, but that's okay. */
33
+ public $Log_Status = KLogger::LOG_CLOSED;
34
+ public $DateFormat = "Y-m-d G:i:s";
35
+ public $MessageQueue;
36
+
37
+ private $log_file;
38
+ private $priority = KLogger::INFO;
39
+
40
+ private $file_handle;
41
+
42
+ public function __construct( $filepath , $priority )
43
+ {
44
+ if ( $priority == KLogger::OFF ) return;
45
+
46
+ $this->log_file = $filepath;
47
+ $this->MessageQueue = array();
48
+ $this->priority = $priority;
49
+
50
+ if ( file_exists( $this->log_file ) )
51
+ {
52
+ if ( !is_writable($this->log_file) )
53
+ {
54
+ $this->Log_Status = KLogger::OPEN_FAILED;
55
+ $this->MessageQueue[] = "The file exists, but could not be opened for writing. Check that appropriate permissions have been set.";
56
+ return;
57
+ }
58
+ }
59
+
60
+ if ( $this->file_handle = fopen( $this->log_file , "a" ) )
61
+ {
62
+ $this->Log_Status = KLogger::LOG_OPEN;
63
+ $this->MessageQueue[] = "The log file was opened successfully.";
64
+ }
65
+ else
66
+ {
67
+ $this->Log_Status = KLogger::OPEN_FAILED;
68
+ $this->MessageQueue[] = "The file could not be opened. Check permissions.";
69
+ }
70
+
71
+ return;
72
+ }
73
+
74
+ public function __destruct()
75
+ {
76
+ if ( $this->file_handle )
77
+ fclose( $this->file_handle );
78
+ }
79
+
80
+ public function LogInfo($line)
81
+ {
82
+ $this->Log( $line , KLogger::INFO );
83
+ }
84
+
85
+ public function LogDebug($line)
86
+ {
87
+ $this->Log( $line , KLogger::DEBUG );
88
+ }
89
+
90
+ public function LogWarn($line)
91
+ {
92
+ $this->Log( $line , KLogger::WARN );
93
+ }
94
+
95
+ public function LogError($line)
96
+ {
97
+ $this->Log( $line , KLogger::ERROR );
98
+ }
99
+
100
+ public function LogFatal($line)
101
+ {
102
+ $this->Log( $line , KLogger::FATAL );
103
+ }
104
+
105
+ public function Log($line, $priority)
106
+ {
107
+ if ( $this->priority <= $priority )
108
+ {
109
+ $status = $this->getTimeLine( $priority );
110
+ $this->WriteFreeFormLine ( "$status $line \n" );
111
+ }
112
+ }
113
+
114
+ public function WriteFreeFormLine( $line )
115
+ {
116
+ if ( $this->Log_Status == KLogger::LOG_OPEN && $this->priority != KLogger::OFF )
117
+ {
118
+ if (fwrite( $this->file_handle , $line ) === false) {
119
+ $this->MessageQueue[] = "The file could not be written to. Check that appropriate permissions have been set.";
120
+ }
121
+ }
122
+ }
123
+
124
+ private function getTimeLine( $level )
125
+ {
126
+ $time = date( $this->DateFormat );
127
+
128
+ switch( $level )
129
+ {
130
+ case KLogger::INFO:
131
+ return "$time | INFO |";
132
+ case KLogger::WARN:
133
+ return "$time | WARN |";
134
+ case KLogger::DEBUG:
135
+ return "$time | DEBUG |";
136
+ case KLogger::ERROR:
137
+ return "$time | ERROR |";
138
+ case KLogger::FATAL:
139
+ return "$time | FATAL |";
140
+ default:
141
+ return "$time | LOG |";
142
+ }
143
+ }
144
+
145
+ }
146
+
147
+
148
+ ?>
app/code/community/BeezUp/lib/LOV/BeezupOMLOVRequest.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMLOVRequest extends BeezupOMRequest {
4
+
5
+ protected $sCultureName = 'en';
6
+ protected $sListName = null;
7
+ /**
8
+ * @return the $sCultureName
9
+ */
10
+ public function getCultureName()
11
+ {
12
+ return $this->sCultureName;
13
+ }
14
+
15
+ /**
16
+ * @param string $sCultureName
17
+ */
18
+ public function setCultureName($sCultureName)
19
+ {
20
+ $this->sCultureName = $sCultureName;
21
+ return $this;
22
+ }
23
+
24
+ /**
25
+ * @return the $sListName
26
+ */
27
+ public function getListName()
28
+ {
29
+ return $this->sListName;
30
+ }
31
+
32
+ /**
33
+ * @param NULL $sListName
34
+ */
35
+ public function setListName($sListName)
36
+ {
37
+ $this->sListName = $sListName;
38
+ return $this;
39
+ }
40
+
41
+
42
+
43
+ }
app/code/community/BeezUp/lib/LOV/BeezupOMLOVResponse.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMLOVResponse extends BeezupOMResponse {
4
+
5
+ public function createResult(array $aData = array()){
6
+ return BeezupOMLOVResult::fromArray($aData);
7
+ }
8
+ public function createRequest(array $aData = array()){
9
+ return BeezupOMLOVRequest::fromArray($aData);
10
+ }
11
+
12
+
13
+
14
+ }
app/code/community/BeezUp/lib/LOV/BeezupOMLOVResult.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMLOVResult extends BeezupOMResult {
4
+
5
+ protected $aValues = array();
6
+
7
+
8
+ /**
9
+ * @return the $aValues
10
+ */
11
+ public function getValues()
12
+ {
13
+ return $this->aValues;
14
+ }
15
+
16
+ /**
17
+ * @param multitype: $aValues
18
+ */
19
+ public function setValues($aValues)
20
+ {
21
+ $this->aValues = $aValues;
22
+ return $this;
23
+ }
24
+
25
+ public function addValue(BeezupOMLOVValue $oValue)
26
+ {
27
+ $this->aValues[] = $oValue;
28
+ return $this;
29
+ }
30
+
31
+ public static function fromArray(array $aData = array()){
32
+ $oResult = new BeezupOMLOVResult();
33
+ if (isset($aData['values']) && is_array($aData['values'])){
34
+ foreach ($aData['values'] as $aValue){
35
+ $oResult->addValue(BeezupOMLOVValue::fromArray($aValue));
36
+ }
37
+ }
38
+ return $oResult;
39
+ }
40
+
41
+ public function toArray(){
42
+ $aResult = array(
43
+ 'values' => array()
44
+ );
45
+
46
+ foreach ($this->getValues() as $oValue){
47
+ $aResult['values'][] = $oValue->toArray();
48
+ }
49
+ return $aResult;
50
+ }
51
+
52
+ public function getCodeIdentifiers(){
53
+ $aResult = array();
54
+ foreach ($this->getValues() as $oValue){
55
+ $aResult[] = $oValue->getCodeIdentifier();
56
+ }
57
+ return $aResult;
58
+ }
59
+
60
+
61
+ }
app/code/community/BeezUp/lib/LOV/BeezupOMLOVValue.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMLOVValue {
4
+
5
+ protected $nPosition = null;
6
+ protected $sCodeIdentifier = null;
7
+ protected $sTranslationText = null;
8
+ protected $nIntIdentifier = null;
9
+
10
+ /**
11
+ * @return the $nPosition
12
+ */
13
+ public function getPosition()
14
+ {
15
+ return $this->nPosition;
16
+ }
17
+
18
+ /**
19
+ * @param NULL $nPosition
20
+ */
21
+ public function setPosition($nPosition)
22
+ {
23
+ $this->nPosition = (int)$nPosition;
24
+ return $this;
25
+ }
26
+
27
+ /**
28
+ * @return the $sCodeIdentifier
29
+ */
30
+ public function getCodeIdentifier()
31
+ {
32
+ return $this->sCodeIdentifier;
33
+ }
34
+
35
+ /**
36
+ * @param NULL $sCodeIdentifier
37
+ */
38
+ public function setCodeIdentifier($sCodeIdentifier)
39
+ {
40
+ $this->sCodeIdentifier = (string)$sCodeIdentifier;
41
+ return $this;
42
+ }
43
+
44
+ /**
45
+ * @return the $sTranslationText
46
+ */
47
+ public function getTranslationText()
48
+ {
49
+ return $this->sTranslationText;
50
+ }
51
+
52
+ /**
53
+ * @param NULL $sTranslationText
54
+ */
55
+ public function setTranslationText($sTranslationText)
56
+ {
57
+ $this->sTranslationText = (string)$sTranslationText;
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * @return the $nIntIdentifier
63
+ */
64
+ public function getIntIdentifier()
65
+ {
66
+ return $this->nIntIdentifier;
67
+ }
68
+
69
+ /**
70
+ * @param NULL $nIntIdentifier
71
+ */
72
+ public function setIntIdentifier($nIntIdentifier)
73
+ {
74
+ $this->nIntIdentifier = (int)$nIntIdentifier;
75
+ return $this;
76
+ }
77
+
78
+ public static function fromArray(array $aData = array()){
79
+ $oValue = new BeezupOMLOVValue();
80
+ foreach ($aData as $sKey=>$mValue){
81
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
82
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
83
+ if (!method_exists($oValue,$sSetterMethod)){
84
+ continue;
85
+ }
86
+ $cCallback = array($oValue,$sSetterMethod);
87
+ if (is_scalar($mValue)){
88
+ call_user_func($cCallback, $mValue);
89
+ } // if
90
+ } // foreach
91
+ return $oValue;
92
+ }
93
+
94
+ public function toArray(){
95
+ return array(
96
+ 'Position' => $this->getPosition(),
97
+ 'CodeIdentifier' => $this->getCodeIdentifier(),
98
+ 'TranslationText' => $this->getTranslationText(),
99
+ 'IntIdentifier' => $this->getIntIdentifier()
100
+ );
101
+ }
102
+
103
+
104
+ }
app/code/community/BeezUp/lib/Order/BeezupOMOrderItem.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderItem {
4
+
5
+ protected $sBeezUPOrderItemId = null;
6
+ protected $sOrderItemOrderItemType = null;
7
+ protected $sOrderItemTitle = null;
8
+ protected $sOrderItemImageUrl = null;
9
+ protected $sOrderItemMerchantProductId = null;
10
+ protected $sOrderItemMarketPlaceProductId = null;
11
+ protected $fOrderItemItemPrice = null;
12
+ protected $nOrderItemQuantity = null;
13
+ protected $fOrderItemShippingPrice = null;
14
+ protected $fOrderItemTotalPrice= null;
15
+ protected $sOrderItemMerchantImportedProductId= null;
16
+ protected $sOrderItemMerchantImportedProductIdColumnName= null;
17
+ protected $sOrderItemMerchantImportedProductUrl= null;
18
+ protected $sOrderItemMerchantProductIdColumnName= null;
19
+ protected $sOrderItemBeezUPStoreId= null;
20
+
21
+
22
+
23
+ /**
24
+ * @return the $sBeezUPOrderItemId
25
+ */
26
+ public function getBeezUPOrderItemId()
27
+ {
28
+ return $this->sBeezUPOrderItemId;
29
+ }
30
+
31
+ /**
32
+ * @param NULL $sBeezUPOrderItemId
33
+ */
34
+ public function setBeezUPOrderItemId($sBeezUPOrderItemId)
35
+ {
36
+ $this->sBeezUPOrderItemId = $sBeezUPOrderItemId;
37
+ return $this;
38
+ }
39
+
40
+ /**
41
+ * @return the $sOrderItemBeezUPStoreId
42
+ */
43
+ public function getOrderItemBeezUPStoreId()
44
+ {
45
+ return $this->sOrderItemBeezUPStoreId;
46
+ }
47
+
48
+ /**
49
+ * @param NULL $sOrderItemBeezUPStoreId
50
+ */
51
+ public function setOrderItemBeezUPStoreId($sOrderItemBeezUPStoreId)
52
+ {
53
+ $this->sOrderItemBeezUPStoreId = $sOrderItemBeezUPStoreId;
54
+ return $this;
55
+
56
+ }
57
+
58
+ /**
59
+ * @return the $sOrderItemImageUrl
60
+ */
61
+ public function getOrderItemImageUrl()
62
+ {
63
+ return $this->sOrderItemImageUrl;
64
+ }
65
+
66
+ /**
67
+ * @param NULL $sOrderItemImageUrl
68
+ */
69
+ public function setOrderItemImageUrl($sOrderItemImageUrl)
70
+ {
71
+ $this->sOrderItemImageUrl = $sOrderItemImageUrl;
72
+ return $this;
73
+
74
+ }
75
+
76
+ /**
77
+ * @return the $fOrderItemItemPrice
78
+ */
79
+ public function getOrderItemItemPrice()
80
+ {
81
+ return $this->fOrderItemItemPrice;
82
+ }
83
+
84
+ /**
85
+ * @param NULL $fOrderItemItemPrice
86
+ */
87
+ public function setOrderItemItemPrice($fOrderItemItemPrice)
88
+ {
89
+ $this->fOrderItemItemPrice = $fOrderItemItemPrice;
90
+ return $this;
91
+
92
+ }
93
+
94
+ /**
95
+ * @return the $sOrderItemMarketPlaceProductId
96
+ */
97
+ public function getOrderItemMarketPlaceProductId()
98
+ {
99
+ return $this->sOrderItemMarketPlaceProductId;
100
+ }
101
+
102
+ /**
103
+ * @param NULL $sOrderItemMarketPlaceProductId
104
+ */
105
+ public function setOrderItemMarketPlaceProductId($sOrderItemMarketPlaceProductId)
106
+ {
107
+ $this->sOrderItemMarketPlaceProductId = $sOrderItemMarketPlaceProductId;
108
+ return $this;
109
+
110
+ }
111
+
112
+ /**
113
+ * @return the $sOrderItemMerchantImportedProductId
114
+ */
115
+ public function getOrderItemMerchantImportedProductId()
116
+ {
117
+ return $this->sOrderItemMerchantImportedProductId;
118
+ }
119
+
120
+ /**
121
+ * @param NULL $sOrderItemMerchantImportedProductId
122
+ */
123
+ public function setOrderItemMerchantImportedProductId($sOrderItemMerchantImportedProductId)
124
+ {
125
+ $this->sOrderItemMerchantImportedProductId = $sOrderItemMerchantImportedProductId;
126
+ return $this;
127
+
128
+ }
129
+
130
+ /**
131
+ * @return the $sOrderItemMerchantImportedProductIdColumnName
132
+ */
133
+ public function getOrderItemMerchantImportedProductIdColumnName()
134
+ {
135
+ return $this->sOrderItemMerchantImportedProductIdColumnName;
136
+ }
137
+
138
+ /**
139
+ * @param NULL $sOrderItemMerchantImportedProductIdColumnName
140
+ */
141
+ public function setOrderItemMerchantImportedProductIdColumnName($sOrderItemMerchantImportedProductIdColumnName)
142
+ {
143
+ $this->sOrderItemMerchantImportedProductIdColumnName = $sOrderItemMerchantImportedProductIdColumnName;
144
+ return $this;
145
+
146
+ }
147
+
148
+ /**
149
+ * @return the $sOrderItemMerchantImportedProductUrl
150
+ */
151
+ public function getOrderItemMerchantImportedProductUrl()
152
+ {
153
+ return $this->sOrderItemMerchantImportedProductUrl;
154
+ }
155
+
156
+ /**
157
+ * @param NULL $sOrderItemMerchantImportedProductUrl
158
+ */
159
+ public function setOrderItemMerchantImportedProductUrl($sOrderItemMerchantImportedProductUrl)
160
+ {
161
+ $this->sOrderItemMerchantImportedProductUrl = $sOrderItemMerchantImportedProductUrl;
162
+ return $this;
163
+
164
+ }
165
+
166
+ /**
167
+ * @return the $sOrderItemMerchantProductId
168
+ */
169
+ public function getOrderItemMerchantProductId()
170
+ {
171
+ return $this->sOrderItemMerchantProductId;
172
+ }
173
+
174
+ /**
175
+ * @param NULL $sOrderItemMerchantProductId
176
+ */
177
+ public function setOrderItemMerchantProductId($sOrderItemMerchantProductId)
178
+ {
179
+ $this->sOrderItemMerchantProductId = $sOrderItemMerchantProductId;
180
+ return $this;
181
+
182
+ }
183
+
184
+ /**
185
+ * @return the $sOrderItemMerchantProductIdColumnName
186
+ */
187
+ public function getOrderItemMerchantProductIdColumnName()
188
+ {
189
+ return $this->sOrderItemMerchantProductIdColumnName;
190
+ }
191
+
192
+ /**
193
+ * @param NULL $sOrderItemMerchantProductIdColumnName
194
+ */
195
+ public function setOrderItemMerchantProductIdColumnName($sOrderItemMerchantProductIdColumnName)
196
+ {
197
+ $this->sOrderItemMerchantProductIdColumnName = $sOrderItemMerchantProductIdColumnName;
198
+ return $this;
199
+
200
+ }
201
+
202
+ /**
203
+ * @return the $sOrderItemOrderItemType
204
+ */
205
+ public function getOrderItemOrderItemType()
206
+ {
207
+ return $this->sOrderItemOrderItemType;
208
+ }
209
+
210
+ /**
211
+ * @param NULL $sOrderItemOrderItemType
212
+ */
213
+ public function setOrderItemOrderItemType($sOrderItemOrderItemType)
214
+ {
215
+ $this->sOrderItemOrderItemType = $sOrderItemOrderItemType;
216
+ return $this;
217
+
218
+ }
219
+
220
+ /**
221
+ * @return the $nOrderItemQuantity
222
+ */
223
+ public function getOrderItemQuantity()
224
+ {
225
+ return $this->nOrderItemQuantity;
226
+ }
227
+
228
+ /**
229
+ * @param NULL $nOrderItemQuantity
230
+ */
231
+ public function setOrderItemQuantity($nOrderItemQuantity)
232
+ {
233
+ $this->nOrderItemQuantity = $nOrderItemQuantity;
234
+ return $this;
235
+
236
+ }
237
+
238
+ /**
239
+ * @return the $fOrderItemShippingPrice
240
+ */
241
+ public function getOrderItemShippingPrice()
242
+ {
243
+ return $this->fOrderItemShippingPrice;
244
+ }
245
+
246
+ /**
247
+ * @param NULL $fOrderItemShippingPrice
248
+ */
249
+ public function setOrderItemShippingPrice($fOrderItemShippingPrice)
250
+ {
251
+ $this->fOrderItemShippingPrice = $fOrderItemShippingPrice;
252
+ return $this;
253
+
254
+ }
255
+
256
+ /**
257
+ * @return the $sOrderItemTitle
258
+ */
259
+ public function getOrderItemTitle()
260
+ {
261
+ return $this->sOrderItemTitle;
262
+ }
263
+
264
+ /**
265
+ * @param NULL $sOrderItemTitle
266
+ */
267
+ public function setOrderItemTitle($sOrderItemTitle)
268
+ {
269
+ $this->sOrderItemTitle = $sOrderItemTitle;
270
+ return $this;
271
+
272
+ }
273
+
274
+ /**
275
+ * @return the $fOrderItemTotalPrice
276
+ */
277
+ public function getOrderItemTotalPrice()
278
+ {
279
+ return $this->fOrderItemTotalPrice;
280
+ }
281
+
282
+ /**
283
+ * @param NULL $fOrderItemTotalPrice
284
+ */
285
+ public function setOrderItemTotalPrice($fOrderItemTotalPrice)
286
+ {
287
+ $this->fOrderItemTotalPrice = $fOrderItemTotalPrice;
288
+ return $this;
289
+
290
+ }
291
+ public static function fromArray(array $aData = array()){
292
+ $oResult = new BeezupOMOrderItem();
293
+ foreach ($aData as $sKey=>$mValue){
294
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
295
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
296
+ if (method_exists($oResult,$sSetterMethod) && is_scalar($mValue)){
297
+ call_user_func(array($oResult,$sSetterMethod), stristr($sKey,'UtcDate') ? new DateTime($mValue, new DateTimeZone('UTC')) : $mValue);
298
+ } // if
299
+ } // foreach
300
+ return $oResult;
301
+ }
302
+ public function toArray(){
303
+ $aResult = array();
304
+ $oReflection = new ReflectionClass($this);
305
+ foreach ($oReflection->getMethods() as $oMethod){
306
+ $sName = $oMethod->getName();
307
+ if (substr($sName,0, 3) === 'get'){
308
+ $sName = str_replace(array('BeezUP', 'UUID', 'ECommerce'), array('Beezup', 'Uuid', 'Ecommerce'), $sName);
309
+ $sExportName = trim(strtolower(preg_replace('/([A-Z])/', '_$1', substr($sName, 3))), '_');
310
+ $aResult[$sExportName] = $this->convert(call_user_func(array($this, $oMethod->getName())));
311
+ }
312
+ }
313
+ return $aResult;
314
+ }
315
+
316
+ protected function convert($mValue){
317
+ if (is_object($mValue)){
318
+ if (method_exists($mValue, 'toArray')){
319
+ $mValue = call_user_func(array($mValue, 'toArray'));
320
+ } else if ($mValue instanceof DateTime){
321
+ $mValue = $mValue->format($this->sDateFormat);
322
+ } else if (method_exists($mValue, '__toString')){
323
+ $mValue = (string)$mValue;
324
+ }
325
+ } else if (is_array($mValue)){
326
+ foreach ($mValue as $mKey => $mElement){
327
+ $mValue[$mKey] = $this->convert($mElement);
328
+ }
329
+ }
330
+ return $mValue;
331
+ }
332
+ }
app/code/community/BeezUp/lib/Order/BeezupOMOrderRequest.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderRequest extends BeezupOMRequest {
4
+
5
+ private $sETagIfNoneMatch = '';
6
+ private $bIgnoreCurrentActivity = false;
7
+ private $oOrderIdentifier = null;
8
+ private $aOrderItemMetaInfoCodes = array();
9
+ private $aOrderMetaInfoCodes = null;
10
+
11
+ /**
12
+ * @return the $sETagIfNoneMatch
13
+ */
14
+ public function getETagIfNoneMatch()
15
+ {
16
+ return $this->sETagIfNoneMatch;
17
+ }
18
+
19
+ /**
20
+ * @return the $bIgnoreCurrentActivity
21
+ */
22
+ public function getIgnoreCurrentActivity()
23
+ {
24
+ return $this->bIgnoreCurrentActivity;
25
+ }
26
+
27
+ public function ignoreCurrentActivity()
28
+ {
29
+ return $this->bIgnoreCurrentActivity;
30
+ }
31
+ /**
32
+ * @return the $oOrderIdentifier
33
+ */
34
+ public function getOrderIdentifier()
35
+ {
36
+ return $this->oOrderIdentifier;
37
+ }
38
+
39
+ /**
40
+ * @return the $aOrderItemMetaInfoCodes
41
+ */
42
+ public function getOrderItemMetaInfoCodes()
43
+ {
44
+ return $this->aOrderItemMetaInfoCodes;
45
+ }
46
+
47
+ /**
48
+ * @return the $aOrderMetaInfoCodes
49
+ */
50
+ public function getOrderMetaInfoCodes()
51
+ {
52
+ return $this->aOrderMetaInfoCodes;
53
+ }
54
+
55
+ /**
56
+ * @param string $sETagIfNoneMatch
57
+ */
58
+ public function setETagIfNoneMatch($sETagIfNoneMatch)
59
+ {
60
+ $this->sETagIfNoneMatch = $sETagIfNoneMatch;
61
+ return $this;
62
+ }
63
+
64
+ /**
65
+ * @param boolean $bIgnoreCurrentActivity
66
+ */
67
+ public function setIgnoreCurrentActivity($bIgnoreCurrentActivity)
68
+ {
69
+ $this->bIgnoreCurrentActivity = $bIgnoreCurrentActivity;
70
+ return $this;
71
+
72
+ }
73
+
74
+ /**
75
+ * @param NULL $oOrderIdentifier
76
+ */
77
+ public function setOrderIdentifier(BeezupOMOrderIdentifier $oOrderIdentifier)
78
+ {
79
+ $this->oOrderIdentifier = $oOrderIdentifier;
80
+ return $this;
81
+
82
+ }
83
+
84
+ /**
85
+ * @param multitype: $aOrderItemMetaInfoCodes
86
+ */
87
+ public function setaOrderItemMetaInfoCodes($aOrderItemMetaInfoCodes)
88
+ {
89
+ $this->aOrderItemMetaInfoCodes = $aOrderItemMetaInfoCodes;
90
+ return $this;
91
+
92
+ }
93
+
94
+ /**
95
+ * @param NULL $aOrderMetaInfoCodes
96
+ */
97
+ public function setOrderMetaInfoCodes($aOrderMetaInfoCodes)
98
+ {
99
+ $this->aOrderMetaInfoCodes = $aOrderMetaInfoCodes;
100
+ return $this;
101
+
102
+ }
103
+
104
+ public static function fromArray(array $aData = array()){
105
+
106
+ $oRequest = new BeezupOMOrderRequest();
107
+ foreach ($aData as $sKey=>$mValue){
108
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
109
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
110
+ if (!method_exists($oRequest,$sSetterMethod)){
111
+ continue;
112
+ }
113
+ $cCallback = array($oRequest,$sSetterMethod);
114
+ if ($sKey == 'orderIdentifier' && is_array($mValue)){
115
+ call_user_func($cCallback, BeezupOMOrderIdentifier::fromArray($mValue));
116
+ } else if (is_scalar($mValue)){
117
+ call_user_func($cCallback, stristr($sSetterMethod,'UtcDate') ? new DateTime($mValue, new DateTimeZone('UTC')) : $mValue);
118
+ } // if
119
+ } // foreach
120
+ return $oRequest;
121
+ }
122
+
123
+ public function toArray(){
124
+ return array(
125
+ 'marketPlace' => $this->getOrderIdentifier()->getMarketplaceTechnicalCode(),
126
+ 'accountId' => $this->getOrderIdentifier()->getAccountId(),
127
+ 'beezUPOrderUUID' => $this->getOrderIdentifier()->getBeezupOrderUUID(),
128
+ 'ignoreCurrentActivity' => $this->getIgnoreCurrentActivity()
129
+ );
130
+ }
131
+
132
+ }
app/code/community/BeezUp/lib/Order/BeezupOMOrderResponse.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @todo Add management of etag, httpstatus, haschanged
5
+ */
6
+ class BeezupOMOrderResponse extends BeezupOMResponse {
7
+
8
+ protected $sJson;
9
+ protected $sEtag;
10
+ protected $nHttpStatus;
11
+ protected $bHasChanged;
12
+ protected $sExecutionId;
13
+
14
+ public function getExecutionId(){
15
+ return $this->sExecutionId;
16
+ }
17
+
18
+ public function setExecutionId($sExecutionId){
19
+ $this->sExecutionId = $sExecutionId;
20
+ return $this;
21
+ }
22
+
23
+ public function getJson(){
24
+ return $this->sJson;
25
+ }
26
+ public function setJson($sJson){
27
+ $this->sJson = $sJson;
28
+ return $this;
29
+ }
30
+
31
+ public function getEtag(){
32
+ return $this->sEtag;
33
+ }
34
+ public function setEtag($sEtag){
35
+ $this->sEtag = $sEtag;
36
+ return $this;
37
+ }
38
+
39
+ public function getHasChanged(){
40
+ return $this->bHasChanged;
41
+ }
42
+
43
+ public function setHasChanged($bHasChanged){
44
+ $this->bHasChanged = (boolean)$bHasChanged;
45
+ return $this;
46
+ }
47
+ public function hasChanged($bHasChanged){
48
+ return $this->bHasChanged;
49
+ }
50
+
51
+ public static function fromArray(array $aData = array()){
52
+ $oResult = new BeezupOMOrderResponse();
53
+ if (is_array($aData) && isset($aData['paginationResult']) && isset($aData['orderHeaders'])){
54
+ $oResult->setPaginationResult(BeezupOMPaginationResult::fromArray($aData['paginationResult']));
55
+ foreach ($aData['orderHeaders'] as $aOrderHeader){
56
+ $oResult->addOrderHeader(BeezupOMOrderHeader::fromArray($aOrderHeader));
57
+ }
58
+ }
59
+ return $oResult;
60
+ }
61
+
62
+ public function parseRawResponse($aParsedResponse){
63
+
64
+ if (is_array($aParsedResponse)){
65
+ $this
66
+ ->setJson(json_encode($aParsedResponse));
67
+ }
68
+ }
69
+
70
+ public function createResult(array $aData = array()){
71
+ return BeezupOMOrderResult::fromArray($aData);
72
+ }
73
+ public function createRequest(array $aData = array()){
74
+ return BeezupOMOrderRequest::fromArray($aData);
75
+ }
76
+
77
+
78
+ }
app/code/community/BeezUp/lib/Order/BeezupOMOrderResult.php ADDED
@@ -0,0 +1,1176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderResult extends BeezupOMResult {
4
+
5
+ protected $sBeezupOrderUUID = null;
6
+ protected $bIsPendingSynchronization = null;
7
+ protected $aLinks = array();
8
+ protected $aTransitionLinks = array();
9
+ protected $sMarketPlaceTechnicalCode = null;
10
+ protected $aOrderItems = array();
11
+ protected $sOrderBuyerAddressCity = null;
12
+ protected $sOrderBuyerAddressCountryIsoCodeAlpha2 = null;
13
+ protected $sOrderBuyerAddressCountryName= null;
14
+ protected $sOrderBuyerAddressLine1 = null;
15
+ protected $sOrderBuyerAddressLine2 = null;
16
+ protected $sOrderBuyerAddressLine3 = null;
17
+ protected $sOrderBuyerAddressPostalCode = null;
18
+ protected $sOrderBuyerStateOrRegion = null;
19
+ protected $sOrderBuyerCivility = null;
20
+ protected $sOrderBuyerCompanyName = null;
21
+ protected $sOrderBuyerEmail = null;
22
+ protected $sOrderBuyerIdentifier = null;
23
+ protected $sOrderBuyerMobilePhone = null;
24
+ protected $sOrderBuyerName = null;
25
+ protected $sOrderBuyerPhone = null;
26
+ protected $sOrderComment = null;
27
+ protected $sOrderCurrencyCode = null;
28
+ protected $oOrderLastModificationUtcDate = null;
29
+ protected $oOrderMarketPlaceLastModificationUtcDate = null;
30
+ protected $sOrderMarketPlaceOrderId = null;
31
+ protected $sOrderMerchantOrderId = null;
32
+ protected $oOrderPayingUtcDate = null;
33
+ protected $sOrderPaymentMethod = null;
34
+ protected $oOrderPurchaseUtcDate = null;
35
+ protected $sOrderShippingAddressCity = null;
36
+ protected $sOrderShippingAddressCountryIsoCodeAlpha2 = null;
37
+ protected $sOrderShippingAddressCountryName= null;
38
+ protected $sOrderShippingAddressLine1 = null;
39
+ protected $sOrderShippingAddressLine2 = null;
40
+ protected $sOrderShippingAddressLine3 = null;
41
+ protected $sOrderShippingAddressName = null;
42
+ protected $sOrderShippingAddressPostalCode = null;
43
+ protected $sOrderShippingCivility = null;
44
+ protected $sOrderShippingCompanyName = null;
45
+ protected $oOrderShippingEarliestShipUtcDate = null;
46
+ protected $sOrderShippingEmail = null;
47
+ protected $oOrderShippingLatestShipUtcDate = null;
48
+ protected $sOrderShippingMethod = null;
49
+ protected $sOrderShippingPhone = null;
50
+ protected $fOrderShippingPrice = null;
51
+ protected $fOrderShippingTax = null;
52
+ protected $sOrderStatusBeezUPOrderStatus = null;
53
+ protected $sOrderStatusMarketPlaceOrderStatus = null;
54
+ protected $fOrderTotalPrice = null;
55
+ protected $fOrderTotalTax = null;
56
+ protected $fOrderTotalCommission = null;
57
+ protected $sOrderShippingAddressStateOrRegion = null;
58
+ protected $sOrderShippingMobilePhone = null;
59
+ protected $fOrderShippingShippingTax = null;
60
+ protected $sOrderMerchantECommerceSoftwareName = null;
61
+ protected $sOrderMerchantECommerceSoftwareVersion = null;
62
+ protected $sOrderStatusMarketPlaceStatus = null;
63
+
64
+ protected $sDateFormat = 'Y-m-d\TH:i:s\Z';//DateTime::ISO8601;
65
+
66
+ /**
67
+ * @return the $sOrderMerchantECommerceSoftwareVersion
68
+ */
69
+ public function getOrderMerchantECommerceSoftwareVersion()
70
+ {
71
+ return $this->sOrderMerchantECommerceSoftwareVersion;
72
+ }
73
+
74
+ /**
75
+ * @return the $sOrderStatusMarketPlaceStatus
76
+ */
77
+ public function getOrderStatusMarketPlaceStatus()
78
+ {
79
+ return $this->sOrderStatusMarketPlaceStatus;
80
+ }
81
+
82
+ /**
83
+ * @param NULL $sOrderMerchantECommerceSoftwareVersion
84
+ */
85
+ public function setOrderMerchantECommerceSoftwareVersion($sOrderMerchantECommerceSoftwareVersion)
86
+ {
87
+ $this->sOrderMerchantECommerceSoftwareVersion = $sOrderMerchantECommerceSoftwareVersion;
88
+ }
89
+
90
+ /**
91
+ * @param NULL $sOrderStatusMarketPlaceStatus
92
+ */
93
+ public function setOrderStatusMarketPlaceStatus($sOrderStatusMarketPlaceStatus)
94
+ {
95
+ $this->sOrderStatusMarketPlaceStatus = $sOrderStatusMarketPlaceStatus;
96
+ }
97
+
98
+ /**
99
+ * @return the $sOrderMerchantECommerceSoftwareName
100
+ */
101
+ public function getOrderMerchantECommerceSoftwareName()
102
+ {
103
+ return $this->sOrderMerchantECommerceSoftwareName;
104
+ }
105
+
106
+ /**
107
+ * @param NULL $sOrderMerchantECommerceSoftwareName
108
+ */
109
+ public function setOrderMerchantECommerceSoftwareName($sOrderMerchantECommerceSoftwareName)
110
+ {
111
+ $this->sOrderMerchantECommerceSoftwareName = $sOrderMerchantECommerceSoftwareName;
112
+ }
113
+
114
+ /**
115
+ * @return the $sBeezupOrderUUID
116
+ */
117
+ public function getBeezupOrderUUID()
118
+ {
119
+ return $this->sBeezupOrderUUID;
120
+ }
121
+
122
+ /**
123
+ * @param NULL $sBeezupOrderUUID
124
+ */
125
+ public function setBeezupOrderUUID($sBeezupOrderUUID)
126
+ {
127
+ $this->sBeezupOrderUUID = $sBeezupOrderUUID;
128
+ return $this;
129
+ }
130
+
131
+ public function isPendingSynchronization()
132
+ {
133
+ return $this->bIsPendingSynchronization;
134
+ }
135
+
136
+ /**
137
+ * @return the $bIsPendingSynchronization
138
+ */
139
+ public function getIsPendingSynchronization()
140
+ {
141
+ return $this->bIsPendingSynchronization;
142
+ }
143
+
144
+ /**
145
+ * @param NULL $bIsPendingSynchronization
146
+ */
147
+ public function setIsPendingSynchronization($bIsPendingSynchronization)
148
+ {
149
+ $this->bIsPendingSynchronization = $bIsPendingSynchronization;
150
+ return $this;
151
+
152
+ }
153
+
154
+ /**
155
+ * @return the $aLinks
156
+ */
157
+ public function getLinks()
158
+ {
159
+ return $this->aLinks;
160
+ }
161
+
162
+ /**
163
+ * @param multitype: $aLinks
164
+ */
165
+ public function setLinks($aLinks)
166
+ {
167
+ $this->aLinks = $aLinks;
168
+ return $this;
169
+ }
170
+
171
+ public function addLink(BeezupOMLink $oLink)
172
+ {
173
+ $this->aLinks[] = $oLink;
174
+ return $this;
175
+ }
176
+
177
+ /**
178
+ * @return the $aLinks
179
+ */
180
+ public function getTransitionLinks()
181
+ {
182
+ return $this->aTransitionLinks;
183
+ }
184
+
185
+ /**
186
+ * @param multitype: $aLinks
187
+ */
188
+ public function setTransitionLinks($aTransitionLinks)
189
+ {
190
+ $this->aTransitionLinks = $aTransitionLinks;
191
+ return $this;
192
+ }
193
+
194
+ public function addTransitionLink(BeezupOMLink $oLink)
195
+ {
196
+ $this->aTransitionLinks[] = $oLink;
197
+ return $this;
198
+ }
199
+ /**
200
+ * @return the $sMarketPlaceTechnicalCode
201
+ */
202
+ public function getMarketPlaceTechnicalCode()
203
+ {
204
+ return $this->sMarketPlaceTechnicalCode;
205
+ }
206
+
207
+ /**
208
+ * @param NULL $sMarketPlaceTechnicalCode
209
+ */
210
+ public function setMarketPlaceTechnicalCode($sMarketPlaceTechnicalCode)
211
+ {
212
+ $this->sMarketPlaceTechnicalCode = $sMarketPlaceTechnicalCode;
213
+ return $this;
214
+
215
+ }
216
+
217
+ /**
218
+ * @return the $aOrderItems
219
+ */
220
+ public function getOrderItems()
221
+ {
222
+ return $this->aOrderItems;
223
+ }
224
+
225
+ /**
226
+ * @param NULL $aOrderItems
227
+ */
228
+ public function setOrderItems($aOrderItems)
229
+ {
230
+ $this->aOrderItems = $aOrderItems;
231
+ return $this;
232
+
233
+ }
234
+
235
+ public function addOrderItem(BeezupOMOrderItem $oOrderItem)
236
+ {
237
+ $this->aOrderItems[] = $oOrderItem;
238
+ return $this;
239
+
240
+ }
241
+
242
+ /**
243
+ * @return the $sOrderBuyerAddressCity
244
+ */
245
+ public function getOrderBuyerAddressCity()
246
+ {
247
+ return $this->sOrderBuyerAddressCity;
248
+ }
249
+
250
+ /**
251
+ * @param NULL $sOrderBuyerAddressCity
252
+ */
253
+ public function setOrderBuyerAddressCity($sOrderBuyerAddressCity)
254
+ {
255
+ $this->sOrderBuyerAddressCity = $sOrderBuyerAddressCity;
256
+ return $this;
257
+
258
+ }
259
+
260
+ /**
261
+ * @return the $sOrderBuyerAddressCountryIsoCodeAlpha2
262
+ */
263
+ public function getOrderBuyerAddressCountryIsoCodeAlpha2()
264
+ {
265
+ return $this->sOrderBuyerAddressCountryIsoCodeAlpha2;
266
+ }
267
+
268
+ /**
269
+ * @param NULL $sOrderBuyerAddressCountryIsoCodeAlpha2
270
+ */
271
+ public function setOrderBuyerAddressCountryIsoCodeAlpha2($sOrderBuyerAddressCountryIsoCodeAlpha2)
272
+ {
273
+ $this->sOrderBuyerAddressCountryIsoCodeAlpha2 = $sOrderBuyerAddressCountryIsoCodeAlpha2;
274
+ return $this;
275
+
276
+ }
277
+
278
+ /**
279
+ * @return the $sOrderBuyerAddressCountryName
280
+ */
281
+ public function getOrderBuyerAddressCountryName()
282
+ {
283
+ return $this->sOrderBuyerAddressCountryName;
284
+ }
285
+
286
+ /**
287
+ * @param NULL $sOrderBuyerAddressCountryName
288
+ */
289
+ public function setOrderBuyerAddressCountryName($sOrderBuyerAddressCountryName)
290
+ {
291
+ $this->sOrderBuyerAddressCountryName = $sOrderBuyerAddressCountryName;
292
+ return $this;
293
+
294
+ }
295
+
296
+ /**
297
+ * @return the $sOrderBuyerAddressLine1
298
+ */
299
+ public function getOrderBuyerAddressLine1()
300
+ {
301
+ return $this->sOrderBuyerAddressLine1;
302
+ }
303
+
304
+ /**
305
+ * @param NULL $sOrderBuyerAddressLine1
306
+ */
307
+ public function setOrderBuyerAddressLine1($sOrderBuyerAddressLine1)
308
+ {
309
+ $this->sOrderBuyerAddressLine1 = $sOrderBuyerAddressLine1;
310
+ return $this;
311
+
312
+ }
313
+
314
+ /**
315
+ * @return the $sOrderBuyerAddressLine2
316
+ */
317
+ public function getOrderBuyerAddressLine2()
318
+ {
319
+ return $this->sOrderBuyerAddressLine2;
320
+ }
321
+
322
+ /**
323
+ * @param NULL $sOrderBuyerAddressLine2
324
+ */
325
+ public function setOrderBuyerAddressLine2($sOrderBuyerAddressLine2)
326
+ {
327
+ $this->sOrderBuyerAddressLine2 = $sOrderBuyerAddressLine2;
328
+ return $this;
329
+
330
+ }
331
+
332
+ /**
333
+ * @return the $sOrderBuyerAddressLine3
334
+ */
335
+ public function getOrderBuyerAddressLine3()
336
+ {
337
+ return $this->sOrderBuyerAddressLine3;
338
+ }
339
+
340
+ /**
341
+ * @param NULL $sOrderBuyerAddressLine3
342
+ */
343
+ public function setOrderBuyerAddressLine3($sOrderBuyerAddressLine3)
344
+ {
345
+ $this->sOrderBuyerAddressLine3 = $sOrderBuyerAddressLine3;
346
+ return $this;
347
+
348
+ }
349
+
350
+ /**
351
+ * @return the $sOrderBuyerAddressPostalCode
352
+ */
353
+ public function getOrderBuyerAddressPostalCode()
354
+ {
355
+ return $this->sOrderBuyerAddressPostalCode;
356
+ }
357
+
358
+ /**
359
+ * @param NULL $sOrderBuyerAddressPostalCode
360
+ */
361
+ public function setOrderBuyerAddressPostalCode($sOrderBuyerAddressPostalCode)
362
+ {
363
+ $this->sOrderBuyerAddressPostalCode = $sOrderBuyerAddressPostalCode;
364
+ return $this;
365
+
366
+ }
367
+
368
+ /**
369
+ * @return the $sOrderBuyerStateOrRegion
370
+ */
371
+ public function getOrderBuyerStateOrRegion()
372
+ {
373
+ return $this->sOrderBuyerStateOrRegion;
374
+ }
375
+
376
+ /**
377
+ * @param NULL $sOrderBuyerStateOrRegion
378
+ */
379
+ public function setOrderBuyerStateOrRegion($sOrderBuyerStateOrRegion)
380
+ {
381
+ $this->sOrderBuyerStateOrRegion = $sOrderBuyerStateOrRegion;
382
+ return $this;
383
+
384
+ }
385
+
386
+ /**
387
+ * @return the $sOrderBuyerCivility
388
+ */
389
+ public function getOrderBuyerCivility()
390
+ {
391
+ return $this->sOrderBuyerCivility;
392
+ }
393
+
394
+ /**
395
+ * @param NULL $sOrderBuyerCivility
396
+ */
397
+ public function setOrderBuyerCivility($sOrderBuyerCivility)
398
+ {
399
+ $this->sOrderBuyerCivility = $sOrderBuyerCivility;
400
+ return $this;
401
+
402
+ }
403
+
404
+ /**
405
+ * @return the $sOrderBuyerCompanyName
406
+ */
407
+ public function getOrderBuyerCompanyName()
408
+ {
409
+ return $this->sOrderBuyerCompanyName;
410
+ }
411
+
412
+ /**
413
+ * @param NULL $sOrderBuyerCompanyName
414
+ */
415
+ public function setOrderBuyerCompanyName($sOrderBuyerCompanyName)
416
+ {
417
+ $this->sOrderBuyerCompanyName = $sOrderBuyerCompanyName;
418
+ return $this;
419
+
420
+ }
421
+
422
+ /**
423
+ * @return the $sOrderBuyerEmail
424
+ */
425
+ public function getOrderBuyerEmail()
426
+ {
427
+ return $this->sOrderBuyerEmail;
428
+ }
429
+
430
+ /**
431
+ * @param NULL $sOrderBuyerEmail
432
+ */
433
+ public function setOrderBuyerEmail($sOrderBuyerEmail)
434
+ {
435
+ $this->sOrderBuyerEmail = $sOrderBuyerEmail;
436
+ return $this;
437
+
438
+ }
439
+
440
+ /**
441
+ * @return the $sOrderBuyerIdentifier
442
+ */
443
+ public function getOrderBuyerIdentifier()
444
+ {
445
+ return $this->sOrderBuyerIdentifier;
446
+ }
447
+
448
+ /**
449
+ * @param NULL $sOrderBuyerIdentifier
450
+ */
451
+ public function setOrderBuyerIdentifier($sOrderBuyerIdentifier)
452
+ {
453
+ $this->sOrderBuyerIdentifier = $sOrderBuyerIdentifier;
454
+ return $this;
455
+
456
+ }
457
+
458
+ /**
459
+ * @return the $sOrderBuyerMobilePhone
460
+ */
461
+ public function getOrderBuyerMobilePhone()
462
+ {
463
+ return $this->sOrderBuyerMobilePhone;
464
+ }
465
+
466
+ /**
467
+ * @param NULL $sOrderBuyerMobilePhone
468
+ */
469
+ public function setOrderBuyerMobilePhone($sOrderBuyerMobilePhone)
470
+ {
471
+ $this->sOrderBuyerMobilePhone = $sOrderBuyerMobilePhone;
472
+ return $this;
473
+
474
+ }
475
+
476
+ /**
477
+ * @return the $sOrderBuyerName
478
+ */
479
+ public function getOrderBuyerName()
480
+ {
481
+ return $this->sOrderBuyerName;
482
+ }
483
+
484
+ /**
485
+ * @param NULL $sOrderBuyerName
486
+ */
487
+ public function setOrderBuyerName($sOrderBuyerName)
488
+ {
489
+ $this->sOrderBuyerName = $sOrderBuyerName;
490
+ return $this;
491
+
492
+ }
493
+
494
+ /**
495
+ * @return the $sOrderBuyerPhone
496
+ */
497
+ public function getOrderBuyerPhone()
498
+ {
499
+ return $this->sOrderBuyerPhone;
500
+ }
501
+
502
+ /**
503
+ * @param NULL $sOrderBuyerPhone
504
+ */
505
+ public function setOrderBuyerPhone($sOrderBuyerPhone)
506
+ {
507
+ $this->sOrderBuyerPhone = $sOrderBuyerPhone;
508
+ return $this;
509
+
510
+ }
511
+
512
+ /**
513
+ * @return the $sOrderComment
514
+ */
515
+ public function getOrderComment()
516
+ {
517
+ return $this->sOrderComment;
518
+ }
519
+
520
+ /**
521
+ * @param NULL $sOrderComment
522
+ */
523
+ public function setOrderComment($sOrderComment)
524
+ {
525
+ $this->sOrderComment = $sOrderComment;
526
+ return $this;
527
+
528
+ }
529
+
530
+ /**
531
+ * @return the $sOrderCurrencyCode
532
+ */
533
+ public function getOrderCurrencyCode()
534
+ {
535
+ return $this->sOrderCurrencyCode;
536
+ }
537
+
538
+ /**
539
+ * @param NULL $sOrderCurrencyCode
540
+ */
541
+ public function setOrderCurrencyCode($sOrderCurrencyCode)
542
+ {
543
+ $this->sOrderCurrencyCode = $sOrderCurrencyCode;
544
+ return $this;
545
+
546
+ }
547
+
548
+ /**
549
+ * @return the $oOrderLastModificationUtcDate
550
+ */
551
+ public function getOrderLastModificationUtcDate()
552
+ {
553
+ return $this->oOrderLastModificationUtcDate;
554
+ }
555
+
556
+ /**
557
+ * @param NULL $oOrderLastModificationUtcDate
558
+ */
559
+ public function setOrderLastModificationUtcDate($oOrderLastModificationUtcDate)
560
+ {
561
+ $this->oOrderLastModificationUtcDate = $oOrderLastModificationUtcDate;
562
+ return $this;
563
+
564
+ }
565
+
566
+ /**
567
+ * @return the $oOrderMarketPlaceLastModificationUtcDate
568
+ */
569
+ public function getOrderMarketPlaceLastModificationUtcDate()
570
+ {
571
+ return $this->oOrderMarketPlaceLastModificationUtcDate;
572
+ }
573
+
574
+ /**
575
+ * @param NULL $oOrderMarketPlaceLastModificationUtcDate
576
+ */
577
+ public function setOrderMarketPlaceLastModificationUtcDate($oOrderMarketPlaceLastModificationUtcDate)
578
+ {
579
+ $this->oOrderMarketPlaceLastModificationUtcDate = $oOrderMarketPlaceLastModificationUtcDate;
580
+ return $this;
581
+
582
+ }
583
+
584
+ /**
585
+ * @return the $sOrderMarketPlaceOrderId
586
+ */
587
+ public function getOrderMarketPlaceOrderId()
588
+ {
589
+ return $this->sOrderMarketPlaceOrderId;
590
+ }
591
+
592
+ /**
593
+ * @param NULL $sOrderMarketPlaceOrderId
594
+ */
595
+ public function setOrderMarketPlaceOrderId($sOrderMarketPlaceOrderId)
596
+ {
597
+ $this->sOrderMarketPlaceOrderId = $sOrderMarketPlaceOrderId;
598
+ return $this;
599
+
600
+ }
601
+
602
+ /**
603
+ * @return the $sOrderMerchantOrderId
604
+ */
605
+ public function getOrderMerchantOrderId()
606
+ {
607
+ return $this->sOrderMerchantOrderId;
608
+ }
609
+
610
+ /**
611
+ * @param NULL $sOrderMerchantOrderId
612
+ */
613
+ public function setOrderMerchantOrderId($sOrderMerchantOrderId)
614
+ {
615
+ $this->sOrderMerchantOrderId = $sOrderMerchantOrderId;
616
+ return $this;
617
+
618
+ }
619
+
620
+ /**
621
+ * @return the $oOrderPayingUtcDate
622
+ */
623
+ public function getOrderPayingUtcDate()
624
+ {
625
+ return $this->oOrderPayingUtcDate;
626
+ }
627
+
628
+ /**
629
+ * @param NULL $oOrderPayingUtcDate
630
+ */
631
+ public function setOrderPayingUtcDate($oOrderPayingUtcDate)
632
+ {
633
+ $this->oOrderPayingUtcDate = $oOrderPayingUtcDate;
634
+ return $this;
635
+
636
+ }
637
+
638
+ /**
639
+ * @return the $sOrderPaymentMethod
640
+ */
641
+ public function getOrderPaymentMethod()
642
+ {
643
+ return $this->sOrderPaymentMethod;
644
+ }
645
+
646
+ /**
647
+ * @param NULL $sOrderPaymentMethod
648
+ */
649
+ public function setOrderPaymentMethod($sOrderPaymentMethod)
650
+ {
651
+ $this->sOrderPaymentMethod = $sOrderPaymentMethod;
652
+ return $this;
653
+
654
+ }
655
+
656
+ /**
657
+ * @return the $oOrderPurchaseUtcDate
658
+ */
659
+ public function getOrderPurchaseUtcDate()
660
+ {
661
+ return $this->oOrderPurchaseUtcDate;
662
+ }
663
+
664
+ /**
665
+ * @param NULL $oOrderPurchaseUtcDate
666
+ */
667
+ public function setOrderPurchaseUtcDate(DateTime $oOrderPurchaseUtcDate)
668
+ {
669
+ $this->oOrderPurchaseUtcDate = $oOrderPurchaseUtcDate;
670
+ return $this;
671
+
672
+ }
673
+
674
+ /**
675
+ * @return the $sOrderShippingAddressCity
676
+ */
677
+ public function getOrderShippingAddressCity()
678
+ {
679
+ return $this->sOrderShippingAddressCity;
680
+ }
681
+
682
+ /**
683
+ * @param NULL $sOrderShippingAddressCity
684
+ */
685
+ public function setOrderShippingAddressCity($sOrderShippingAddressCity)
686
+ {
687
+ $this->sOrderShippingAddressCity = $sOrderShippingAddressCity;
688
+ return $this;
689
+
690
+ }
691
+
692
+ /**
693
+ * @return the $sOrderShippingAddressCountryIsoCodeAlpha2
694
+ */
695
+ public function getOrderShippingAddressCountryIsoCodeAlpha2()
696
+ {
697
+ return $this->sOrderShippingAddressCountryIsoCodeAlpha2;
698
+ }
699
+
700
+ /**
701
+ * @param NULL $sOrderShippingAddressCountryIsoCodeAlpha2
702
+ */
703
+ public function setOrderShippingAddressCountryIsoCodeAlpha2($sOrderShippingAddressCountryIsoCodeAlpha2)
704
+ {
705
+ $this->sOrderShippingAddressCountryIsoCodeAlpha2 = $sOrderShippingAddressCountryIsoCodeAlpha2;
706
+ return $this;
707
+
708
+ }
709
+
710
+ /**
711
+ * @return the $sOrderShippingAddressCountryName
712
+ */
713
+ public function getOrderShippingAddressCountryName()
714
+ {
715
+ return $this->sOrderShippingAddressCountryName;
716
+ }
717
+
718
+ /**
719
+ * @param NULL $sOrderShippingAddressCountryName
720
+ */
721
+ public function setOrderShippingAddressCountryName($sOrderShippingAddressCountryName)
722
+ {
723
+ $this->sOrderShippingAddressCountryName = $sOrderShippingAddressCountryName;
724
+ return $this;
725
+ }
726
+
727
+ /**
728
+ * @return the $sOrderShippingAddressLine1
729
+ */
730
+ public function getOrderShippingAddressLine1()
731
+ {
732
+ return $this->sOrderShippingAddressLine1;
733
+ }
734
+
735
+ /**
736
+ * @param NULL $sOrderShippingAddressLine1
737
+ */
738
+ public function setOrderShippingAddressLine1($sOrderShippingAddressLine1)
739
+ {
740
+ $this->sOrderShippingAddressLine1 = $sOrderShippingAddressLine1;
741
+ return $this;
742
+
743
+ }
744
+
745
+ /**
746
+ * @return the $sOrderShippingAddressLine2
747
+ */
748
+ public function getOrderShippingAddressLine2()
749
+ {
750
+ return $this->sOrderShippingAddressLine2;
751
+ }
752
+
753
+ /**
754
+ * @param NULL $sOrderShippingAddressLine2
755
+ */
756
+ public function setOrderShippingAddressLine2($sOrderShippingAddressLine2)
757
+ {
758
+ $this->sOrderShippingAddressLine2 = $sOrderShippingAddressLine2;
759
+ return $this;
760
+
761
+ }
762
+
763
+ /**
764
+ * @return the $sOrderShippingAddressLine3
765
+ */
766
+ public function getOrderShippingAddressLine3()
767
+ {
768
+ return $this->sOrderShippingAddressLine3;
769
+ }
770
+
771
+ /**
772
+ * @param NULL $sOrderShippingAddressLine3
773
+ */
774
+ public function setOrderShippingAddressLine3($sOrderShippingAddressLine3)
775
+ {
776
+ $this->sOrderShippingAddressLine3 = $sOrderShippingAddressLine3;
777
+ return $this;
778
+
779
+ }
780
+
781
+ /**
782
+ * @return the $sOrderShippingAddressName
783
+ */
784
+ public function getOrderShippingAddressName()
785
+ {
786
+ return $this->sOrderShippingAddressName;
787
+ }
788
+
789
+ /**
790
+ * @param NULL $sOrderShippingAddressName
791
+ */
792
+ public function setOrderShippingAddressName($sOrderShippingAddressName)
793
+ {
794
+ $this->sOrderShippingAddressName = $sOrderShippingAddressName;
795
+ return $this;
796
+
797
+ }
798
+
799
+ /**
800
+ * @return the $sOrderShippingAddressPostalCode
801
+ */
802
+ public function getOrderShippingAddressPostalCode()
803
+ {
804
+ return $this->sOrderShippingAddressPostalCode;
805
+ }
806
+
807
+ /**
808
+ * @param NULL $sOrderShippingAddressPostalCode
809
+ */
810
+ public function setOrderShippingAddressPostalCode($sOrderShippingAddressPostalCode)
811
+ {
812
+ $this->sOrderShippingAddressPostalCode = $sOrderShippingAddressPostalCode;
813
+ return $this;
814
+
815
+ }
816
+
817
+ /**
818
+ * @return the $sOrderShippingStateOrRegion
819
+ */
820
+ public function getOrderShippingAddressStateOrRegion()
821
+ {
822
+ return $this->sOrderShippingAddressStateOrRegion;
823
+ }
824
+
825
+ /**
826
+ * @param NULL $sOrderShippingStateOrRegion
827
+ */
828
+ public function setOrderShippingAddressStateOrRegion($sOrderShippingAddressStateOrRegion)
829
+ {
830
+ $this->sOrderShippingAddressStateOrRegion = $sOrderShippingAddressStateOrRegion;
831
+ return $this;
832
+
833
+ }
834
+
835
+ /**
836
+ * @return the $sOrderShippingCivility
837
+ */
838
+ public function getOrderShippingCivility()
839
+ {
840
+ return $this->sOrderShippingCivility;
841
+ }
842
+
843
+ /**
844
+ * @param NULL $sOrderShippingCivility
845
+ */
846
+ public function setOrderShippingCivility($sOrderShippingCivility)
847
+ {
848
+ $this->sOrderShippingCivility = $sOrderShippingCivility;
849
+ return $this;
850
+
851
+ }
852
+
853
+ /**
854
+ * @return the $sOrderShippingCompanyName
855
+ */
856
+ public function getOrderShippingCompanyName()
857
+ {
858
+ return $this->sOrderShippingCompanyName;
859
+ }
860
+
861
+ /**
862
+ * @param NULL $sOrderShippingCompanyName
863
+ */
864
+ public function setOrderShippingCompanyName($sOrderShippingCompanyName)
865
+ {
866
+ $this->sOrderShippingCompanyName = $sOrderShippingCompanyName;
867
+ return $this;
868
+
869
+ }
870
+
871
+ /**
872
+ * @return the $oOrderShippingEarliestShipUtcDate
873
+ */
874
+ public function getOrderShippingEarliestShipUtcDate()
875
+ {
876
+ return $this->oOrderShippingEarliestShipUtcDate;
877
+ }
878
+
879
+ /**
880
+ * @param NULL $oOrderShippingEarliestShipUtcDate
881
+ */
882
+ public function setOrderShippingEarliestShipUtcDate($oOrderShippingEarliestShipUtcDate)
883
+ {
884
+ $this->oOrderShippingEarliestShipUtcDate = $oOrderShippingEarliestShipUtcDate;
885
+ return $this;
886
+
887
+ }
888
+
889
+ /**
890
+ * @return the $sOrderShippingEmail
891
+ */
892
+ public function getOrderShippingEmail()
893
+ {
894
+ return $this->sOrderShippingEmail;
895
+ }
896
+
897
+ /**
898
+ * @param NULL $sOrderShippingEmail
899
+ */
900
+ public function setOrderShippingEmail($sOrderShippingEmail)
901
+ {
902
+ $this->sOrderShippingEmail = $sOrderShippingEmail;
903
+ return $this;
904
+
905
+ }
906
+
907
+ /**
908
+ * @return the $oOrderShippingLatestShipUtcDate
909
+ */
910
+ public function getOrderShippingLatestShipUtcDate()
911
+ {
912
+ return $this->oOrderShippingLatestShipUtcDate;
913
+ }
914
+
915
+ /**
916
+ * @param NULL $oOrderShippingLatestShipUtcDate
917
+ */
918
+ public function setOrderShippingLatestShipUtcDate($oOrderShippingLatestShipUtcDate)
919
+ {
920
+ $this->oOrderShippingLatestShipUtcDate = $oOrderShippingLatestShipUtcDate;
921
+ return $this;
922
+
923
+ }
924
+
925
+ /**
926
+ * @return the $sOrderShippingMethod
927
+ */
928
+ public function getOrderShippingMethod()
929
+ {
930
+ return $this->sOrderShippingMethod;
931
+ }
932
+
933
+ /**
934
+ * @param NULL $sOrderShippingMethod
935
+ */
936
+ public function setOrderShippingMethod($sOrderShippingMethod)
937
+ {
938
+ $this->sOrderShippingMethod = $sOrderShippingMethod;
939
+ return $this;
940
+
941
+ }
942
+
943
+ /**
944
+ * @return the $sOrderShippingMobile
945
+ */
946
+ public function getOrderShippingMobilePhone()
947
+ {
948
+ return $this->sOrderShippingMobilePhone;
949
+ }
950
+
951
+ /**
952
+ * @param NULL $sOrderShippingMobile
953
+ */
954
+ public function setOrderShippingMobilePhone($sOrderShippingMobilePhone)
955
+ {
956
+ $this->sOrderShippingMobilePhone = $sOrderShippingMobilePhone;
957
+ return $this;
958
+
959
+ }
960
+
961
+ /**
962
+ * @return the $sOrderShippingPhone
963
+ */
964
+ public function getOrderShippingPhone()
965
+ {
966
+ return $this->sOrderShippingPhone;
967
+ }
968
+
969
+ /**
970
+ * @param NULL $sOrderShippingPhone
971
+ */
972
+ public function setOrderShippingPhone($sOrderShippingPhone)
973
+ {
974
+ $this->sOrderShippingPhone = $sOrderShippingPhone;
975
+ return $this;
976
+
977
+ }
978
+
979
+ /**
980
+ * @return the $fOrderShippingPrice
981
+ */
982
+ public function getOrderShippingPrice()
983
+ {
984
+ return $this->fOrderShippingPrice;
985
+ }
986
+
987
+ /**
988
+ * @param NULL $fOrderShippingPrice
989
+ */
990
+ public function setOrderShippingPrice($fOrderShippingPrice)
991
+ {
992
+ $this->fOrderShippingPrice = $fOrderShippingPrice;
993
+ return $this;
994
+
995
+ }
996
+
997
+ /**
998
+ * @return the $fOrderShippingTax
999
+ */
1000
+ public function getOrderShippingShippingTax()
1001
+ {
1002
+ return $this->fOrderShippingShippingTax;
1003
+ }
1004
+
1005
+ /**
1006
+ * @param NULL $fOrderShippingTax
1007
+ */
1008
+ public function setOrderShippingShippingTax($fOrderShippingShippingTax)
1009
+ {
1010
+ $this->fOrderShippingShippingTax = $fOrderShippingShippingTax;
1011
+ return $this;
1012
+
1013
+ }
1014
+
1015
+ /**
1016
+ * @return the $sOrderStatusBeezUPOrderStatus
1017
+ */
1018
+ public function getOrderStatusBeezUPOrderStatus()
1019
+ {
1020
+ return $this->sOrderStatusBeezUPOrderStatus;
1021
+ }
1022
+
1023
+ /**
1024
+ * @param NULL $sOrderStatusBeezUPOrderStatus
1025
+ */
1026
+ public function setOrderStatusBeezUPOrderStatus($sOrderStatusBeezUPOrderStatus)
1027
+ {
1028
+ $this->sOrderStatusBeezUPOrderStatus = $sOrderStatusBeezUPOrderStatus;
1029
+ return $this;
1030
+
1031
+ }
1032
+
1033
+ /**
1034
+ * @return the $sOrderStatusMarketPlaceOrderStatus
1035
+ */
1036
+ public function getOrderStatusMarketPlaceOrderStatus()
1037
+ {
1038
+ return $this->sOrderStatusMarketPlaceOrderStatus;
1039
+ }
1040
+
1041
+ /**
1042
+ * @param NULL $sOrderStatusMarketPlaceOrderStatus
1043
+ */
1044
+ public function setOrderStatusMarketPlaceOrderStatus($sOrderStatusMarketPlaceOrderStatus)
1045
+ {
1046
+ $this->sOrderStatusMarketPlaceOrderStatus = $sOrderStatusMarketPlaceOrderStatus;
1047
+ return $this;
1048
+
1049
+ }
1050
+
1051
+ /**
1052
+ * @return the $fOrderTotalCommision
1053
+ */
1054
+ public function getOrderTotalCommission()
1055
+ {
1056
+ return $this->fOrderTotalCommission;
1057
+ }
1058
+
1059
+ /**
1060
+ * @param NULL $fOrderTotalCommision
1061
+ */
1062
+ public function setOrderTotalCommission($fOrderTotalCommission)
1063
+ {
1064
+ $this->fOrderTotalCommission = $fOrderTotalCommission;
1065
+ return $this;
1066
+
1067
+ }
1068
+
1069
+ /**
1070
+ * @return the $fOrderTotalPrice
1071
+ */
1072
+ public function getOrderTotalPrice()
1073
+ {
1074
+ return $this->fOrderTotalPrice;
1075
+ }
1076
+
1077
+ /**
1078
+ * @param NULL $fOrderTotalPrice
1079
+ */
1080
+ public function setOrderTotalPrice($fOrderTotalPrice)
1081
+ {
1082
+ $this->fOrderTotalPrice = $fOrderTotalPrice;
1083
+ return $this;
1084
+
1085
+ }
1086
+
1087
+ /**
1088
+ * @return the $fOrderTotalTax
1089
+ */
1090
+ public function getOrderTotalTax()
1091
+ {
1092
+ return $this->fOrderTotalTax;
1093
+ }
1094
+
1095
+ /**
1096
+ * @param NULL $fOrderTotalTax
1097
+ */
1098
+ public function setOrderTotalTax($fOrderTotalTax)
1099
+ {
1100
+ $this->fOrderTotalTax = $fOrderTotalTax;
1101
+ return $this;
1102
+
1103
+ }
1104
+
1105
+ /**
1106
+ * Ugly hack as we do not have accountid in order result
1107
+ * @return Ambigous <>|NULL
1108
+ */
1109
+ public function getAccountId(){
1110
+ $sResult = null;
1111
+ if (!empty($this->aLinks) && isset($this->aLinks[0])){
1112
+ /**
1113
+ * @var BeezupOMLink
1114
+ */
1115
+ $oLink = $this->aLinks[0];
1116
+ $aAtoms = explode('/', $oLink->getHref());
1117
+ if (isset($aAtoms[6]) && $aAtoms[4] == $this->getMarketPlaceTechnicalCode() && $aAtoms[6]== $this->getBeezupOrderUUID() && is_numeric($aAtoms[5])){
1118
+ return $aAtoms[5];
1119
+ }
1120
+
1121
+ }
1122
+ return null;
1123
+ }
1124
+
1125
+
1126
+ public function getLinkByRel($sRel){
1127
+ foreach ($this->getLinks() as $oLink){
1128
+ if ($oLink->getRel() === $sRel){
1129
+ return $oLink;
1130
+ }
1131
+ }
1132
+ return null;
1133
+ }
1134
+
1135
+ public function getTransitionLinkByRel($sRel){
1136
+ foreach ($this->getTransitionLinks() as $oLink){
1137
+ if ($oLink->getRel() === $sRel){
1138
+ return $oLink;
1139
+ }
1140
+ }
1141
+ return null;
1142
+ }
1143
+
1144
+ protected function toCamelCase($text) {
1145
+ return preg_replace_callback('#_(\S)#', function ($matches) {
1146
+ return strtoupper($matches[1]);
1147
+ }, $text);
1148
+ }
1149
+
1150
+ public static function fromArray(array $aData = array()){
1151
+ $oResult = new BeezupOMOrderResult();
1152
+ foreach ($aData as $sKey=>$mValue){
1153
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
1154
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
1155
+ if ($sCamelCaseKey == 'orderItems' && is_array($mValue)){
1156
+ foreach ($mValue as $aOrderItem){
1157
+ $oResult->addOrderItem(BeezupOMOrderItem::fromArray($aOrderItem));
1158
+ }
1159
+ } else if ($sCamelCaseKey == 'links' && is_array($mValue)){
1160
+ foreach ($mValue as $aLink){
1161
+ $oResult->addLink(BeezupOMLink::fromArray($aLink));
1162
+ }
1163
+ } else if ($sCamelCaseKey == 'transitionLinks' && is_array($mValue)){
1164
+ foreach ($mValue as $aLink){
1165
+ $oResult->addTransitionLink(BeezupOMLink::fromArray($aLink));
1166
+ }
1167
+ } else if (method_exists($oResult,$sSetterMethod) && is_scalar($mValue)){
1168
+ call_user_func(array($oResult,$sSetterMethod), stristr($sSetterMethod,'UtcDate') ? new DateTime($mValue, new DateTimeZone('UTC')) : $mValue);
1169
+ } // if
1170
+ } // foreach
1171
+ return $oResult;
1172
+ }
1173
+
1174
+
1175
+
1176
+ }
app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeMetaInfo.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderChangeMetaInfo {
4
+
5
+ protected $sCSharpType = null;
6
+ protected $sName = null;
7
+ protected $sValue = null;
8
+
9
+
10
+ /**
11
+ * @return the $sCode
12
+ */
13
+ public function getName()
14
+ {
15
+ return $this->sName;
16
+ }
17
+
18
+ /**
19
+ * @param NULL $sCode
20
+ */
21
+ public function setName($sName)
22
+ {
23
+ $this->sName = (string)$sName;
24
+ return $this;
25
+ }
26
+
27
+ /**
28
+ * @return the $sCSharpType
29
+ */
30
+ public function getCSharpType()
31
+ {
32
+ return $this->sCSharpType;
33
+ }
34
+
35
+ /**
36
+ * @param NULL $sCSharpType
37
+ */
38
+ public function setCSharpType($sCSharpType)
39
+ {
40
+ $this->sCSharpType = $sCSharpType;
41
+ return $this;
42
+ }
43
+
44
+ /**
45
+ * @return the $sCode
46
+ */
47
+ public function getValue()
48
+ {
49
+ return $this->sValue;
50
+ }
51
+
52
+ /**
53
+ * @param NULL $sCode
54
+ */
55
+ public function setValue($sValue)
56
+ {
57
+ $this->sValue = (string)sValue;
58
+ return $this;
59
+ }
60
+
61
+
62
+ public static function fromArray(array $aData = array()){
63
+ $oValue = new BeezupOMExpectedOrderChangeMetaInfo();
64
+ foreach ($aData as $sKey=>$mValue){
65
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
66
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
67
+ if (!method_exists($oValue,$sSetterMethod)){
68
+ continue;
69
+ }
70
+ $cCallback = array($oValue,$sSetterMethod);
71
+ if (is_scalar($mValue) && !is_null($mValue)){
72
+ call_user_func($cCallback, $mValue);
73
+ } // if
74
+ } // foreach
75
+ return $oValue;
76
+ }
77
+
78
+ public function toArray(){
79
+ return array(
80
+ "cSharpType" => $this->getCSharpType(),
81
+ "value" => $this->getValue(),
82
+ "name" => $this->getName(),
83
+ );
84
+ }
85
+
86
+ }
app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeRequest.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderChangeRequest extends BeezupOMRequest {
4
+
5
+ protected $sEtagIfMatch = null;
6
+ protected $aMetaInfo = array();
7
+ protected $oOrderIdentifier = null;
8
+ protected $sUserName = null;
9
+ protected $bTestMode = true; // on prendre pas de risk
10
+
11
+ protected $sMethod = self::METHOD_POST;
12
+
13
+ public static function fromArray(array $aData = array()){
14
+ $oRequest = new BeezupOMOrderChangeRequest();
15
+ foreach ($aData as $sKey=>$mValue){
16
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
17
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
18
+ if (!method_exists($oRequest,$sSetterMethod)){
19
+ continue;
20
+ }
21
+ $cCallback = array($oRequest,$sSetterMethod);
22
+ if (is_scalar($mValue) && !is_null($mValue)){
23
+ call_user_func($cCallback, $mValue);
24
+ } // if
25
+ } // foreach
26
+ return $oRequest;
27
+ }
28
+
29
+
30
+ /**
31
+ * @return the $sEtagIfMatch
32
+ */
33
+ public function getEtagIfMatch()
34
+ {
35
+ return $this->sEtagIfMatch;
36
+ }
37
+
38
+ /**
39
+ * @param NULL $sEtagIfMatch
40
+ */
41
+ public function setEtagIfMatch($sEtagIfMatch)
42
+ {
43
+ $this->sEtagIfMatch = $sEtagIfMatch;
44
+ return $this;
45
+ }
46
+
47
+ /**
48
+ * @return the $aMetaInfo
49
+ */
50
+ public function getMetaInfo()
51
+ {
52
+ return $this->aMetaInfo;
53
+ }
54
+
55
+ /**
56
+ * @param multitype: $aMetaInfo
57
+ */
58
+ public function setMetaInfo($aMetaInfo)
59
+ {
60
+ $this->aMetaInfo = $aMetaInfo;
61
+ return $this;
62
+ }
63
+
64
+ public function addMetaInfo($oMetaInfo)
65
+ {
66
+ $this->aMetaInfo[] = $oMetaInfo;
67
+ return $this;
68
+ }
69
+
70
+ /**
71
+ * @return the $oOrderIdentifier
72
+ */
73
+ public function getOrderIdentifier()
74
+ {
75
+ return $this->oOrderIdentifier;
76
+ }
77
+
78
+ /**
79
+ * @param NULL $oOrderIdentifier
80
+ */
81
+ public function setOrderIdentifier(BeezupOMOrderIdentifier $oOrderIdentifier)
82
+ {
83
+ $this->oOrderIdentifier = $oOrderIdentifier;
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ * @return the $sUserName
89
+ */
90
+ public function getUserName()
91
+ {
92
+ return $this->sUserName;
93
+ }
94
+
95
+ /**
96
+ * @param NULL $sUserName
97
+ */
98
+ public function setUserName($sUserName)
99
+ {
100
+ $this->sUserName = $sUserName;
101
+ return $this;
102
+ }
103
+
104
+ public function isTestMode($bTestMode){
105
+ return $this->bTestMode;
106
+ }
107
+
108
+ public function setTestMode($bTestMode){
109
+ $this->bTestMode = $bTestMode;
110
+ return $this;
111
+ }
112
+
113
+ public function getTestMode(){
114
+ return $this->bTestMode;
115
+ }
116
+
117
+ }
app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeResponse.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderChangeResponse extends BeezupOMResponse {
4
+
5
+ protected $sEtag = null;
6
+ protected $nHttpStatus = null;
7
+ protected $oInfo = null;
8
+ protected $sJson = null;
9
+ protected $oRequest = null;
10
+ protected $oResult = null;
11
+
12
+
13
+ /**
14
+ * @return the $sEtag
15
+ */
16
+ public function getEtag()
17
+ {
18
+ return $this->sEtag;
19
+ }
20
+
21
+ /**
22
+ * @param NULL $sEtag
23
+ */
24
+ public function setEtag($sEtag)
25
+ {
26
+ $this->sEtag = $sEtag;
27
+ return $this;
28
+
29
+ }
30
+
31
+ /**
32
+ * @return the $nHttpStatus
33
+ */
34
+ public function getHttpStatus()
35
+ {
36
+ return $this->nHttpStatus;
37
+ }
38
+
39
+ /**
40
+ * @param NULL $nHttpStatus
41
+ */
42
+ public function setHttpStatus($nHttpStatus)
43
+ {
44
+ $this->nHttpStatus = (int)$nHttpStatus;
45
+ return $this;
46
+ }
47
+
48
+ /**
49
+ * @return the $oInfo
50
+ */
51
+ public function getInfo()
52
+ {
53
+ return $this->oInfo;
54
+ }
55
+
56
+ /**
57
+ * @param NULL $oInfo
58
+ */
59
+ public function setInfo(BeezupOMInfoSummaries $oInfo)
60
+ {
61
+ $this->oInfo = $oInfo;
62
+ return $this;
63
+ }
64
+
65
+ /**
66
+ * @return the $sJson
67
+ */
68
+ public function getJson()
69
+ {
70
+ return $this->sJson;
71
+ }
72
+
73
+ /**
74
+ * @param NULL $sJson
75
+ */
76
+ public function setJson($sJson)
77
+ {
78
+ $this->sJson = $sJson;
79
+ return $this;
80
+ }
81
+
82
+ public function createResult(array $aData = array()){
83
+ return BeezupOMOrderChangeResult::fromArray($aData);
84
+ }
85
+ public function createRequest(array $aData = array()){
86
+ return BeezupOMOrderChangeRequest::fromArray($aData);
87
+ }
88
+ }
app/code/community/BeezUp/lib/OrderChange/BeezupOMOrderChangeResult.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderChangeResult extends BeezupOMResult {
4
+
5
+ protected $sExecutionUUID = null;
6
+ protected $aLinks = null;
7
+
8
+ public static function fromArray(array $aData = array()){
9
+
10
+ $oResult = new BeezupOMOrderChangeResult();
11
+
12
+ foreach ($aData['links'] as $aLink){
13
+ $oResult->addLink(BeezupOMLink::fromArray($aLink));
14
+ }
15
+
16
+ $oResult->setExecutionUUID($aData['executionUUID']);
17
+
18
+ return $oResult;
19
+
20
+ }
21
+
22
+
23
+ /**
24
+ * @return the $sExecutionUUID
25
+ */
26
+ public function getExecutionUUID()
27
+ {
28
+ return $this->sExecutionUUID;
29
+ }
30
+
31
+ /**
32
+ * @param NULL $sExecutionUUID
33
+ */
34
+ public function setExecutionUUID($sExecutionUUID)
35
+ {
36
+ $this->sExecutionUUID = (string)$sExecutionUUID;
37
+ }
38
+
39
+
40
+
41
+ public function getLinkByRel($sRel){
42
+ foreach ($this->getLinks() as $oLink){
43
+ if ($oLink->getRel() === $sRel){
44
+ return $oLink;
45
+ }
46
+ }
47
+ return null;
48
+ }
49
+ /**
50
+ * @return the $aLinks
51
+ */
52
+ public function getLinks()
53
+ {
54
+ return $this->aLinks;
55
+ }
56
+
57
+ /**
58
+ * @param multitype: $aLinks
59
+ */
60
+ public function setLinks($aLinks)
61
+ {
62
+ $this->aLinks = $aLinks;
63
+ return $this;
64
+ }
65
+
66
+ public function addLink(BeezupOMLink $oLink)
67
+ {
68
+ $this->aLinks[] = $oLink;
69
+ return $this;
70
+ }
71
+
72
+
73
+
74
+
75
+ }
app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderChangeReporting.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderChangeReporting {
4
+
5
+ protected $oCreationUtcDate = null;
6
+ protected $sErrorMessage = null;
7
+ protected $sExecutionUUID = null;
8
+ protected $sIPAddress = null;
9
+ protected $bIsTestMode = null;
10
+ protected $oLastUpdateUtcDate = null;
11
+ protected $sOrderChangeType = null;
12
+ protected $sSourceType = null;
13
+ protected $sSourceUserId = null;
14
+ protected $sSourceUserName = null;
15
+ protected $sWarningMessage = null;
16
+
17
+
18
+ public static function fromArray(array $aData = array()){
19
+ $oResult = new BeezupOMOrderChangeReporting();
20
+ foreach ($aData as $sKey=>$mValue){
21
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
22
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
23
+ if (method_exists($oResult,$sSetterMethod) && is_scalar($mValue)){
24
+ call_user_func(array($oResult,$sSetterMethod), stristr($sSetterMethod,'UtcDate') ? new DateTime($mValue, new DateTimeZone('UTC')) : $mValue);
25
+ } // if
26
+ } // foreach
27
+ return $oResult;
28
+ }
29
+
30
+
31
+
32
+ /**
33
+ * @return the $oCreationUtcDate
34
+ */
35
+ public function getCreationUtcDate()
36
+ {
37
+ return $this->oCreationUtcDate;
38
+ }
39
+
40
+ /**
41
+ * @param NULL $oCreationUtcDate
42
+ */
43
+ public function setCreationUtcDate(DateTime $oCreationUtcDate)
44
+ {
45
+ $this->oCreationUtcDate = $oCreationUtcDate;
46
+ return $this;
47
+
48
+ }
49
+
50
+ /**
51
+ * @return the $sErrorMessage
52
+ */
53
+ public function getErrorMessage()
54
+ {
55
+ return $this->sErrorMessage;
56
+ }
57
+
58
+ /**
59
+ * @param NULL $sErrorMessage
60
+ */
61
+ public function setErrorMessage($sErrorMessage)
62
+ {
63
+ $this->sErrorMessage = $sErrorMessage;
64
+ return $this;
65
+
66
+ }
67
+
68
+ /**
69
+ * @return the $sExecutionUUID
70
+ */
71
+ public function getSExecutionUUID()
72
+ {
73
+ return $this->sExecutionUUID;
74
+ }
75
+
76
+ /**
77
+ * @param NULL $sExecutionUUID
78
+ */
79
+ public function setExecutionUUID($sExecutionUUID)
80
+ {
81
+ $this->sExecutionUUID = $sExecutionUUID;
82
+ return $this;
83
+
84
+ }
85
+
86
+ /**
87
+ * @return the $sIPAddress
88
+ */
89
+ public function getIPAddress()
90
+ {
91
+ return $this->sIPAddress;
92
+
93
+ }
94
+
95
+ /**
96
+ * @param NULL $sIPAddress
97
+ */
98
+ public function setIPAddress($sIPAddress)
99
+ {
100
+ $this->sIPAddress = $sIPAddress;
101
+ return $this;
102
+
103
+ }
104
+
105
+ /**
106
+ * @return the $bIsTestMode
107
+ */
108
+ public function getIsTestMode()
109
+ {
110
+ return $this->bIsTestMode;
111
+
112
+ }
113
+
114
+ public function isTestMode()
115
+ {
116
+ return $this->bIsTestMode;
117
+
118
+ }
119
+ /**
120
+ * @param NULL $bIsTestMode
121
+ */
122
+ public function setIsTestMode($bIsTestMode)
123
+ {
124
+ $this->bIsTestMode = (boolean)$bIsTestMode;
125
+ return $this;
126
+
127
+ }
128
+
129
+ /**
130
+ * @return the $oLastUpdateUtcDate
131
+ */
132
+ public function getLastUpdateUtcDate()
133
+ {
134
+ return $this->oLastUpdateUtcDate;
135
+ }
136
+
137
+ /**
138
+ * @param NULL $oLastUpdateUtcDate
139
+ */
140
+ public function setLastUpdateUtcDate($oLastUpdateUtcDate)
141
+ {
142
+ $this->oLastUpdateUtcDate = $oLastUpdateUtcDate;
143
+ return $this;
144
+ }
145
+
146
+ /**
147
+ * @return the $sOrderChangeType
148
+ */
149
+ public function getOrderChangeType()
150
+ {
151
+ return $this->sOrderChangeType;
152
+ }
153
+
154
+ /**
155
+ * @param NULL $sOrderChangeType
156
+ */
157
+ public function setOrderChangeType($sOrderChangeType)
158
+ {
159
+ $this->sOrderChangeType = $sOrderChangeType;
160
+ return $this;
161
+ }
162
+
163
+ /**
164
+ * @return the $sSourceType
165
+ */
166
+ public function getSourceType()
167
+ {
168
+ return $this->sSourceType;
169
+ }
170
+
171
+ /**
172
+ * @param NULL $sSourceType
173
+ */
174
+ public function setSourceType($sSourceType)
175
+ {
176
+ $this->sSourceType = $sSourceType;
177
+ return $this;
178
+ }
179
+
180
+ /**
181
+ * @return the $sSourceUserId
182
+ */
183
+ public function getSourceUserId()
184
+ {
185
+ return $this->sSourceUserId;
186
+ }
187
+
188
+ /**
189
+ * @param NULL $sSourceUserId
190
+ */
191
+ public function setSourceUserId($sSourceUserId)
192
+ {
193
+ $this->sSourceUserId = $sSourceUserId;
194
+ return $this;
195
+ }
196
+
197
+ /**
198
+ * @return the $sSourceUserName
199
+ */
200
+ public function getSourceUserName()
201
+ {
202
+ return $this->sSourceUserName;
203
+ }
204
+
205
+ /**
206
+ * @param NULL $sSourceUserName
207
+ */
208
+ public function setSourceUserName($sSourceUserName)
209
+ {
210
+ $this->sSourceUserName = $sSourceUserName;
211
+ return $this;
212
+ }
213
+
214
+ /**
215
+ * @return the $sWarningMessage
216
+ */
217
+ public function getWarningMessage()
218
+ {
219
+ return $this->sWarningMessage;
220
+ }
221
+
222
+ /**
223
+ * @param NULL $sWarningMessage
224
+ */
225
+ public function setWarningMessage($sWarningMessage)
226
+ {
227
+ $this->sWarningMessage = $sWarningMessage;
228
+ return $this;
229
+ }
230
+
231
+ }
app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHarvestReporting.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderHarvestReporting {
4
+
5
+ protected $sBeezUPForcedStatus = null;
6
+ protected $sBeezUPStatus = null;
7
+ protected $oCreationUtcDate = null;
8
+ protected $sErrorMessage = null;
9
+ protected $sExecutionUUID = null;
10
+ protected $sLastupdateUtcDate = null;
11
+ protected $sProcessingStatus = null;
12
+ protected $sWarningMessage = null;
13
+
14
+
15
+ public static function fromArray(array $aData = array()){
16
+ $oResult = new BeezupOMOrderHarvestReporting();
17
+ foreach ($aData as $sKey=>$mValue){
18
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
19
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
20
+ if (method_exists($oResult,$sSetterMethod) && is_scalar($mValue)){
21
+ call_user_func(array($oResult,$sSetterMethod), stristr($sSetterMethod,'UtcDate') ? new DateTime($mValue, new DateTimeZone('UTC')) : $mValue);
22
+ } // if
23
+ } // foreach
24
+ return $oResult;
25
+ }
26
+
27
+ /**
28
+ * @return the $sBeezUPForcedStatus
29
+ */
30
+ public function getBeezUPForcedStatus()
31
+ {
32
+ return $this->sBeezUPForcedStatus;
33
+ }
34
+
35
+ /**
36
+ * @param NULL $sBeezUPForcedStatus
37
+ */
38
+ public function setBeezUPForcedStatus($sBeezUPForcedStatus)
39
+ {
40
+ $this->sBeezUPForcedStatus = $sBeezUPForcedStatus;
41
+ return $this;
42
+ }
43
+
44
+ /**
45
+ * @return the $sBeezUPStatus
46
+ */
47
+ public function getBeezUPStatus()
48
+ {
49
+ return $this->sBeezUPStatus;
50
+ }
51
+
52
+ /**
53
+ * @param NULL $sBeezUPStatus
54
+ */
55
+ public function setBeezUPStatus($sBeezUPStatus)
56
+ {
57
+ $this->sBeezUPStatus = $sBeezUPStatus;
58
+ return $this;
59
+
60
+ }
61
+
62
+ /**
63
+ * @return the $oCreationUtcDate
64
+ */
65
+ public function getCreationUtcDate()
66
+ {
67
+ return $this->oCreationUtcDate;
68
+ return $this;
69
+
70
+ }
71
+
72
+ /**
73
+ * @param NULL $oCreationUtcDate
74
+ */
75
+ public function setCreationUtcDate(DateTime $oCreationUtcDate)
76
+ {
77
+ $this->oCreationUtcDate = $oCreationUtcDate;
78
+ return $this;
79
+
80
+ }
81
+
82
+ /**
83
+ * @return the $sErrorMessage
84
+ */
85
+ public function getErrorMessage()
86
+ {
87
+ return $this->sErrorMessage;
88
+ }
89
+
90
+ /**
91
+ * @param NULL $sErrorMessage
92
+ */
93
+ public function setErrorMessage($sErrorMessage)
94
+ {
95
+ $this->sErrorMessage = $sErrorMessage;
96
+ return $this;
97
+
98
+ }
99
+
100
+ /**
101
+ * @return the $sExecutionUUID
102
+ */
103
+ public function getSExecutionUUID()
104
+ {
105
+ return $this->sExecutionUUID;
106
+ }
107
+
108
+ /**
109
+ * @param NULL $sExecutionUUID
110
+ */
111
+ public function setExecutionUUID($sExecutionUUID)
112
+ {
113
+ $this->sExecutionUUID = $sExecutionUUID;
114
+ return $this;
115
+
116
+ }
117
+
118
+ /**
119
+ * @return the $sLastupdateUtcDate
120
+ */
121
+ public function getLastupdateUtcDate()
122
+ {
123
+ return $this->sLastupdateUtcDate;
124
+ }
125
+
126
+ /**
127
+ * @param NULL $sLastupdateUtcDate
128
+ */
129
+ public function setLastupdateUtcDate($sLastupdateUtcDate)
130
+ {
131
+ $this->sLastupdateUtcDate = $sLastupdateUtcDate;
132
+ return $this;
133
+
134
+ }
135
+
136
+ /**
137
+ * @return the $sProcessingStatus
138
+ */
139
+ public function getProcessingStatus()
140
+ {
141
+ return $this->sProcessingStatus;
142
+ }
143
+
144
+ /**
145
+ * @param NULL $sProcessingStatus
146
+ */
147
+ public function setProcessingStatus($sProcessingStatus)
148
+ {
149
+ $this->sProcessingStatus = $sProcessingStatus;
150
+ return $this;
151
+
152
+ }
153
+
154
+ /**
155
+ * @return the $sWarningMessage
156
+ */
157
+ public function getWarningMessage()
158
+ {
159
+ return $this->sWarningMessage;
160
+ }
161
+
162
+ /**
163
+ * @param NULL $sWarningMessage
164
+ */
165
+ public function setWarningMessage($sWarningMessage)
166
+ {
167
+ $this->sWarningMessage = $sWarningMessage;
168
+ return $this;
169
+ }
170
+
171
+
172
+ }
app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHistoryRequest.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderHistoryRequest extends BeezupOMRequest {
4
+
5
+ protected $sEtagIfNoneMatch = null;
6
+ protected $oOrderIdentifier = null;
7
+
8
+ // @todo
9
+ public static function fromArray(array $aData = array()){
10
+ $oRequest = new BeezupOMOrderHistoryRequest();
11
+ $oOrderIdentifier = BeezupOMOrderIdentifier::fromArray(
12
+ array(
13
+ 'beezuporderuuid' => $aData['beezUPOrderUUID'],
14
+ 'marketplace' => $aData['marketPlaceTechnicalCode'],
15
+ 'accountid' => $aData['accountId'],
16
+ )
17
+ );
18
+ $oRequest->setOrderIdentifier($oOrderIdentifier);
19
+
20
+ return $oRequest;
21
+
22
+ }
23
+
24
+ public function toArray(array $aData = array()){
25
+ return array(
26
+ 'EtagIfNoneMatch' => $this->getEtagIfNoneMatch(),
27
+ 'accountId' => $this->getOrderIdentifier()->getAccountId(),
28
+ 'beezUPOrderUUID' => $this->getOrderIdentifier()->getBeezupOrderUUID(),
29
+ 'ignoreCurrentActivity' => $this->getIgnoreCurrentActivity()
30
+ );
31
+ }
32
+
33
+ /**
34
+ *
35
+ *
36
+ * @return the $sEtagIfNoneMatch
37
+ */
38
+ public function getEtagIfNoneMatch()
39
+ {
40
+ return $this->sEtagIfNoneMatch;
41
+ }
42
+
43
+ /**
44
+ * @param NULL $sEtagIfNoneMatch
45
+ */
46
+ public function setEtagIfNoneMatch($sEtagIfNoneMatch)
47
+ {
48
+ $this->sEtagIfNoneMatch = $sEtagIfNoneMatch;
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * @return the $oOrderIdentifier
54
+ */
55
+ public function getOrderIdentifier()
56
+ {
57
+ return $this->oOrderIdentifier;
58
+ }
59
+
60
+ /**
61
+ * @param NULL $oOrderIdentifier
62
+ */
63
+ public function setOrderIdentifier(BeezupOMOrderIdentifier $oOrderIdentifier)
64
+ {
65
+ $this->oOrderIdentifier = $oOrderIdentifier;
66
+ return $this;
67
+ }
68
+
69
+ }
app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHistoryResponse.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderHistoryResponse extends BeezupOMResponse {
4
+
5
+ protected $sEtag = null;
6
+ protected $nHttpStatus = null;
7
+ /**
8
+ * @return the $sEtag
9
+ */
10
+ public function getEtag()
11
+ {
12
+ return $this->sEtag;
13
+ }
14
+
15
+ /**
16
+ * @param NULL $sEtag
17
+ */
18
+ public function setEtag($sEtag)
19
+ {
20
+ $this->sEtag = $sEtag;
21
+ return $this;
22
+
23
+ }
24
+
25
+ /**
26
+ * @return the $nHttpStatus
27
+ */
28
+ public function getHttpStatus()
29
+ {
30
+ return $this->nHttpStatus;
31
+ }
32
+
33
+ /**
34
+ * @param NULL $nHttpStatus
35
+ */
36
+ public function setHttpStatus($nHttpStatus)
37
+ {
38
+ $this->nHttpStatus = (int)$nHttpStatus;
39
+ return $this;
40
+ }
41
+
42
+ public function createResult(array $aData = array()){
43
+ return BeezupOMOrderHistoryResult::fromArray($aData);
44
+ }
45
+ public function createRequest(array $aData = array()){
46
+ return BeezupOMOrderHistoryRequest::fromArray($aData);
47
+ }
48
+
49
+ }
app/code/community/BeezUp/lib/OrderHistory/BeezupOMOrderHistoryResult.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderHistoryResult extends BeezupOMResult {
4
+
5
+ protected $oLastModificationUtcData = null;
6
+ protected $aOrderChangeReporting = array();
7
+ protected $aOrderHarvestReporting = array();
8
+
9
+
10
+
11
+ /**
12
+ *
13
+ *
14
+ * @param array $aData
15
+ * @return BeezupOMOrderListResult
16
+ */
17
+
18
+ /**
19
+ * @return the $oLastModificationUtcData
20
+ */
21
+ public function getLastModificationUtcData()
22
+ {
23
+ return $this->oLastModificationUtcData;
24
+ }
25
+
26
+ /**
27
+ * @param NULL $oLastModificationUtcData
28
+ */
29
+ public function setLastModificationUtcData(DateTime $oLastModificationUtcData)
30
+ {
31
+ $this->oLastModificationUtcData = $oLastModificationUtcData;
32
+ return $this;
33
+ }
34
+
35
+ /**
36
+ * @return the $aOrderChangeReporting
37
+ */
38
+ public function getOrderChangeReporting()
39
+ {
40
+ return $this->aOrderChangeReporting;
41
+ }
42
+
43
+ /**
44
+ * @param multitype: $aOrderChangeReporting
45
+ */
46
+ public function setOrderChangeReporting($aOrderChangeReporting)
47
+ {
48
+ $this->aOrderChangeReporting = $aOrderChangeReporting;
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * @param multitype: $aOrderChangeReporting
54
+ */
55
+ public function addOrderChangeReporting($oOrderChangeReporting)
56
+ {
57
+ $this->aOrderChangeReporting[] = $oOrderChangeReporting;
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * @return the $aOrderHarvestReporting
63
+ */
64
+ public function getOrderHarvestReporting()
65
+ {
66
+ return $this->aOrderHarvestReporting;
67
+ }
68
+
69
+ /**
70
+ * @param multitype: $aOrderHarvestReporting
71
+ */
72
+ public function setOrderHarvestReporting($aOrderHarvestReporting)
73
+ {
74
+ $this->aOrderHarvestReporting = $aOrderHarvestReporting;
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * @param multitype: $aOrderHarvestReporting
80
+ */
81
+ public function addOrderHarvestReporting($oOrderHarvestReporting)
82
+ {
83
+ $this->aOrderHarvestReporting[] = $oOrderHarvestReporting;
84
+ return $this;
85
+ }
86
+
87
+ public static function fromArray(array $aData = array()){
88
+ $oResult = new BeezupOMOrderHistoryResult();
89
+ if (is_array($aData) && isset($aData['OrderChangeReportings'])){
90
+ foreach ($aData['OrderChangeReportings'] as $aOrderChangeReporting){
91
+ $oResult->addOrderChangeReporting(BeezupOMOrderChangeReporting::fromArray($aOrderChangeReporting));
92
+ }
93
+ }
94
+ if (is_array($aData) && isset($aData['OrderHarvestReportings'])){
95
+ foreach ($aData['OrderHarvestReportings'] as $aOrderHarvestReporting){
96
+ $oResult->addOrderHarvestReporting(BeezupOMOrderharvestReporting::fromArray($aOrderHarvestReporting));
97
+ }
98
+ }
99
+ $oResult->setLastModificationUtcData(new DateTime($aData['lastModificationUtcDate'], new DateTimeZone('UTC')));
100
+ return $oResult;
101
+ }
102
+
103
+ }
app/code/community/BeezUp/lib/OrderList/BeezupOMOrderHeader.php ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class BeezupOMOrderHeader {
3
+
4
+ private $nAccountId = null;
5
+ private $sBeezupOrderState = null;
6
+ private $sBeezupOrderUUID = null;
7
+ private $sBuyerFullName = null;
8
+ private $sETag = null;
9
+ private $sIsoCurrencyCode = null;
10
+ private $bIsPendingSynchronization = null;
11
+ private $oLastModificationUtcDate = null;
12
+ private $aLinks = array();
13
+ private $oMarketPlaceLastModificationUtcDate = null;
14
+ private $sMarketPlaceOrderId = null;
15
+ private $sMarketPlaceOrderState = null;
16
+ private $sMarketPlaceTechnicalCode = null;
17
+ private $sMerchantOrderId = null;
18
+ private $oPurchaseUtcDate = null;
19
+ private $fTotalAmount = null;
20
+
21
+ /**
22
+ * @return the $nAccountId
23
+ */
24
+ public function getAccountId()
25
+ {
26
+ return $this->nAccountId;
27
+ }
28
+
29
+ /**
30
+ * @param NULL $nAccountId
31
+ */
32
+ public function setAccountId($nAccountId)
33
+ {
34
+ $this->nAccountId = $nAccountId;
35
+ return $this;
36
+
37
+ }
38
+
39
+ /**
40
+ * @return the $sBeezupOrderState
41
+ */
42
+ public function getBeezupOrderState()
43
+ {
44
+ return $this->sBeezupOrderState;
45
+ }
46
+
47
+ /**
48
+ * @param NULL $sBeezupOrderState
49
+ */
50
+ public function setBeezupOrderState($sBeezupOrderState)
51
+ {
52
+ $this->sBeezupOrderState = $sBeezupOrderState;
53
+ return $this;
54
+
55
+ }
56
+
57
+ /**
58
+ * @return the $sbeezupOrderUUID
59
+ */
60
+ public function getBeezupOrderUUID()
61
+ {
62
+ return $this->sBeezupOrderUUID;
63
+ }
64
+
65
+ /**
66
+ * @param NULL $sbeezupOrderUUID
67
+ */
68
+ public function setBeezupOrderUUID($sBeezupOrderUUID)
69
+ {
70
+ $this->sBeezupOrderUUID = $sBeezupOrderUUID;
71
+ return $this;
72
+
73
+ }
74
+
75
+ /**
76
+ * @return the $sBuyerFullName
77
+ */
78
+ public function getBuyerFullName()
79
+ {
80
+ return $this->sBuyerFullName;
81
+ }
82
+
83
+ /**
84
+ * @param NULL $sBuyerFullName
85
+ */
86
+ public function setBuyerFullName($sBuyerFullName)
87
+ {
88
+ $this->sBuyerFullName = $sBuyerFullName;
89
+ return $this;
90
+
91
+ }
92
+
93
+ /**
94
+ * @return the $sETag
95
+ */
96
+ public function getETag()
97
+ {
98
+ return $this->sETag;
99
+ }
100
+
101
+ /**
102
+ * @param NULL $sETag
103
+ */
104
+ public function setETag($sETag)
105
+ {
106
+ $this->sETag = $sETag;
107
+ return $this;
108
+
109
+ }
110
+
111
+ /**
112
+ * @return the $sIsoCurrencyCode
113
+ */
114
+ public function getIsoCurrencyCode()
115
+ {
116
+ return $this->sIsoCurrencyCode;
117
+ }
118
+
119
+ /**
120
+ * @param NULL $sIsoCurrencyCode
121
+ */
122
+ public function setIsoCurrencyCode($sIsoCurrencyCode)
123
+ {
124
+ $this->sIsoCurrencyCode = $sIsoCurrencyCode;
125
+ return $this;
126
+
127
+ }
128
+
129
+ public function isPendingSynchronization()
130
+ {
131
+ return $this->bIsPendingSynchronization;
132
+ }
133
+
134
+
135
+ /**
136
+ * @return the $bIsPendingSynchronization
137
+ */
138
+ public function getIsPendingSynchronization()
139
+ {
140
+ return $this->bIsPendingSynchronization;
141
+ }
142
+
143
+ /**
144
+ * @param NULL $bIsPendingSynchronization
145
+ */
146
+ public function setIsPendingSynchronization($bIsPendingSynchronization)
147
+ {
148
+ $this->bIsPendingSynchronization = $bIsPendingSynchronization;
149
+ return $this;
150
+
151
+ }
152
+
153
+ /**
154
+ * @return the $oLastModificationUtcDate
155
+ */
156
+ public function getLastModificationUtcDate()
157
+ {
158
+ return $this->oLastModificationUtcDate;
159
+ }
160
+
161
+ /**
162
+ * @param NULL $oLastModificationUtcDate
163
+ */
164
+ public function setLastModificationUtcDate($oLastModificationUtcDate)
165
+ {
166
+ $this->oLastModificationUtcDate = $oLastModificationUtcDate;
167
+ return $this;
168
+
169
+ }
170
+
171
+ /**
172
+ * @return the $aLinks
173
+ */
174
+ public function getLinks()
175
+ {
176
+ return $this->aLinks;
177
+ }
178
+ public function getLinkByRel($sRel){
179
+ foreach ($this->getLinks() as $oLink){
180
+ if ($oLink->getRel() === $sRel){
181
+ return $oLink;
182
+ }
183
+ }
184
+ return null;
185
+ }
186
+ /**
187
+ * @param multitype: $aLinks
188
+ */
189
+ public function setLinks($aLinks)
190
+ {
191
+ $this->aLinks = $aLinks;
192
+ return $this;
193
+
194
+ }
195
+
196
+ public function addLink(BeezupOMLink $oLink)
197
+ {
198
+ $this->aLinks[] = $oLink;
199
+ return $this;
200
+
201
+ }
202
+
203
+ /**
204
+ * @return the $oMarketPlaceLastModificationUtcDate
205
+ */
206
+ public function getMarketPlaceLastModificationUtcDate()
207
+ {
208
+ return $this->oMarketPlaceLastModificationUtcDate;
209
+ }
210
+
211
+ /**
212
+ * @param NULL $oMarketPlaceLastModificationUtcDate
213
+ */
214
+ public function setMarketPlaceLastModificationUtcDate($oMarketPlaceLastModificationUtcDate)
215
+ {
216
+ $this->oMarketPlaceLastModificationUtcDate = $oMarketPlaceLastModificationUtcDate;
217
+ return $this;
218
+
219
+ }
220
+
221
+ /**
222
+ * @return the $sMarketPlaceOrderId
223
+ */
224
+ public function getMarketPlaceOrderId()
225
+ {
226
+ return $this->sMarketPlaceOrderId;
227
+ }
228
+
229
+ /**
230
+ * @param NULL $sMarketPlaceOrderId
231
+ */
232
+ public function setMarketPlaceOrderId($sMarketPlaceOrderId)
233
+ {
234
+ $this->sMarketPlaceOrderId = $sMarketPlaceOrderId;
235
+ return $this;
236
+
237
+ }
238
+
239
+ /**
240
+ * @return the $sMarketPlaceOrderState
241
+ */
242
+ public function getMarketPlaceOrderState()
243
+ {
244
+ return $this->sMarketPlaceOrderState;
245
+ }
246
+
247
+ /**
248
+ * @param NULL $sMarketPlaceOrderState
249
+ */
250
+ public function setMarketPlaceOrderState($sMarketPlaceOrderState)
251
+ {
252
+ $this->sMarketPlaceOrderState = $sMarketPlaceOrderState;
253
+ return $this;
254
+
255
+ }
256
+
257
+ /**
258
+ * @return the $sMarketPlaceTechnicalCode
259
+ */
260
+ public function getMarketPlaceTechnicalCode()
261
+ {
262
+ return $this->sMarketPlaceTechnicalCode;
263
+ }
264
+
265
+ /**
266
+ * @param NULL $sMarketPlaceTechnicalCode
267
+ */
268
+ public function setMarketPlaceTechnicalCode($sMarketPlaceTechnicalCode)
269
+ {
270
+ $this->sMarketPlaceTechnicalCode = $sMarketPlaceTechnicalCode;
271
+ return $this;
272
+
273
+ }
274
+
275
+ /**
276
+ * @return the $sMerchantOrderId
277
+ */
278
+ public function getMerchantOrderId()
279
+ {
280
+ return $this->sMerchantOrderId;
281
+ }
282
+
283
+ /**
284
+ * @param NULL $sMerchantOrderId
285
+ */
286
+ public function setMerchantOrderId($sMerchantOrderId)
287
+ {
288
+ $this->sMerchantOrderId = $sMerchantOrderId;
289
+ return $this;
290
+
291
+ }
292
+
293
+ /**
294
+ * @return the $oPurchaseUtcDate
295
+ */
296
+ public function getPurchaseUtcDate()
297
+ {
298
+ return $this->oPurchaseUtcDate;
299
+ }
300
+
301
+ /**
302
+ * @param NULL $oPurchaseUtcDate
303
+ */
304
+ public function setPurchaseUtcDate($oPurchaseUtcDate)
305
+ {
306
+ $this->oPurchaseUtcDate = $oPurchaseUtcDate;
307
+ return $this;
308
+
309
+ }
310
+
311
+ /**
312
+ * @return the $fTotalAmount
313
+ */
314
+ public function getTotalAmount()
315
+ {
316
+ return $this->fTotalAmount;
317
+ }
318
+
319
+ /**
320
+ * @param NULL $fTotalAmount
321
+ */
322
+ public function setTotalAmount($fTotalAmount)
323
+ {
324
+ $this->fTotalAmount = $fTotalAmount;
325
+ return $this;
326
+ }
327
+
328
+ public static function fromArray(array $aData = array()){
329
+
330
+ // @todo orderMetaInfos ?
331
+ $oOrderHeader = new BeezupOMOrderHeader();
332
+ $oOrderHeader
333
+ ->setMarketPlaceOrderId($aData['marketPlaceOrderId'])
334
+ ->setBeezupOrderState($aData['beezUPOrderState'])
335
+ ->setBeezupOrderState($aData['beezUPOrderState'])
336
+ ->setPurchaseUtcDate(new DateTime($aData['purchaseUtcDate'], new DateTimeZone('UTC')))
337
+ ->setBuyerFullName($aData['buyerFullName'])
338
+ ->setLastModificationUtcDate(new DateTime($aData['lastModificationUtcDate'], new DateTimeZone('UTC')))
339
+ ->setTotalAmount($aData['totalAmount'])
340
+ ->setIsoCurrencyCode($aData['isoCurrencyCode'])
341
+ ->setMerchantOrderId($aData['merchantOrderId'])
342
+ ->setIsPendingSynchronization($aData['isPendingSynchronization'])
343
+ ->setETag($aData['eTag'])
344
+ ->setMarketPlaceLastModificationUtcDate($aData['marketPlaceLastModificationUtcDate']);
345
+ foreach ($aData['links'] as $aLink){
346
+ $oOrderHeader->addLink(BeezupOMLink::fromArray($aLink));
347
+ }
348
+ return $oOrderHeader;
349
+ }
350
+
351
+ }
app/code/community/BeezUp/lib/OrderList/BeezupOMOrderListRequest.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderListRequest extends BeezupOMRequest {
4
+
5
+ private $aAccountIds = array();
6
+ private $aBeezupOrderStates = array();
7
+ private $oBeginPeriodUtcDate = null;
8
+ private $oEndPeriodUtcDate = null;
9
+ private $sDateSearchType = 'Modification';
10
+ private $nEntriesPerPage = 100;
11
+ private $aMarketPlaceOrderIds = array();
12
+ private $aMarketPlaceTechnicalCodes = array();
13
+ private $nPageNumber = 1;
14
+ private $sBuyerFullName = null;
15
+
16
+ public function __construct(){
17
+ $this->setBeginPeriodUtcDate(new DateTime('now', new DateTimeZone('UTC')));
18
+ $this->setEndPeriodUtcDate(new DateTime('now', new DateTimeZone('UTC')));
19
+ }
20
+ public static function fromArray(array $aData = array()){
21
+ $oRequest = new BeezupOMOrderListRequest();
22
+ foreach ($aData as $sKey=>$mValue){
23
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
24
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
25
+ if (!method_exists($oRequest,$sSetterMethod)){
26
+ continue;
27
+ }
28
+ $cCallback = array($oRequest,$sSetterMethod);
29
+ if ($sKey == 'accountIds' || $sKey=='marketPlaceOrderIds' || $sKey =='beezUPOrderStates' || $sKey=='marketPlaceTechnicalCodes'){
30
+ call_user_func($cCallback, is_array($mValue) ? $mValue : explode(',', (string)$mValue));
31
+ } else if (is_scalar($mValue)){
32
+ call_user_func($cCallback, stristr($sSetterMethod,'UtcDate') ? new DateTime($mValue, new DateTimeZone('UTC')) : $mValue);
33
+ } // if
34
+ } // foreach
35
+ return $oRequest;
36
+ }
37
+
38
+ public function toArray(){
39
+ return array(
40
+ 'beezUPOrderStates' => implode(',', $this->getBeezupOrderStates()),
41
+ 'beginPeriodUtcDate' => $this->getBeginPeriodUtcDate()->format($this->sDateFormat),
42
+ 'endPeriodUtcDate' => $this->getEndPeriodUtcDate()->format($this->sDateFormat),
43
+ 'entriesPerPage' => $this->getEntriesPerPage(),
44
+ 'pageNumber' => $this->getPageNumber(),
45
+ 'dateSearchType' => $this->getDateSearchType(),
46
+ 'marketPlaceTechnicalCodes' => implode(',', $this->getMarketPlaceTechnicalCodes()),
47
+ 'buyerFullName' => $this->getBuyerFullName(),
48
+ 'marketPlaceOrderIds' => implode(',', $this->getMarketPlaceOrderIds()),
49
+ 'accountIds' => implode(',', $this->getAccountIds()),
50
+ );
51
+ }
52
+
53
+ public function setAccountIds(array $aAccountIds = array()){
54
+ $this->aAccountIds = $aAccountIds;
55
+ return $this;
56
+ }
57
+ public function getAccountIds(){
58
+ return $this->aAccountIds;
59
+ }
60
+ public function setBeezupOrderStates(array $aBeezupOrderStates = array()){
61
+ $this->aBeezupOrderStates = $aBeezupOrderStates;
62
+ return $this;
63
+ }
64
+ public function getBeezupOrderStates(){
65
+ return $this->aBeezupOrderStates;
66
+ }
67
+
68
+ public function setBeginPeriodUtcDate(DateTime $oBeginPeriodUtcDate){
69
+ $this->oBeginPeriodUtcDate = $oBeginPeriodUtcDate;
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @return Datetime|null
76
+ */
77
+ public function getBeginPeriodUtcDate(){
78
+ // -2H en dur
79
+ return $this->oBeginPeriodUtcDate;
80
+ }
81
+
82
+ public function setEndPeriodUtcDate(DateTime $oEndPeriodUtcDate){
83
+ $this->oEndPeriodUtcDate = $oEndPeriodUtcDate;
84
+ return $this;
85
+ }
86
+ public function getEndPeriodUtcDate(){
87
+ return $this->oEndPeriodUtcDate;
88
+ }
89
+
90
+ public function setEntriesPerPage($nEntriesPerPage){
91
+ $this->nEntriesPerPage = min(100, max(25, (int)$nEntriesPerPage));
92
+ return $this;
93
+ }
94
+ public function getEntriesPerPage(){
95
+ return $this->nEntriesPerPage;
96
+ }
97
+
98
+ public function setPageNumber($nPageNumber){
99
+ $this->nPageNumber = (int)$nPageNumber;
100
+ return $this;
101
+ }
102
+ public function getPageNumber(){
103
+ return $this->nPageNumber;
104
+ }
105
+
106
+ public function setDateSearchType($sDateSearchType){
107
+ $this->sDateSearchType = $sDateSearchType;
108
+ return $this;
109
+ }
110
+ public function getDateSearchType(){
111
+ return $this->sDateSearchType;
112
+ }
113
+
114
+ public function setMarketPlaceTechnicalCodes(array $aMarketPlaceTechnicalCodes = array()){
115
+ $this->aMarketPlaceTechnicalCodes = $aMarketPlaceTechnicalCodes;
116
+ return $this;
117
+ }
118
+ public function getMarketPlaceTechnicalCodes(){
119
+ return $this->aMarketPlaceTechnicalCodes;
120
+ }
121
+
122
+ public function setBuyerFullName($sBuyerFullName){
123
+ $this->sBuyerFullName = (string)$sBuyerFullName;
124
+ return $this;
125
+ }
126
+
127
+ public function getBuyerFullName(){
128
+ return $this->sBuyerFullName;
129
+ }
130
+
131
+ public function setMarketPlaceOrderIds(array $aMarketPlaceOrderIds = array()){
132
+ $this->aMarketPlaceOrderIds = $aMarketPlaceOrderIds;
133
+ return $this;
134
+ }
135
+ public function getMarketPlaceOrderIds(){
136
+ return $this->aMarketPlaceOrderIds;
137
+ }
138
+
139
+
140
+ }
app/code/community/BeezUp/lib/OrderList/BeezupOMOrderListResponse.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderListResponse extends BeezupOMResponse {
4
+
5
+ protected $sExecutionId = null;
6
+
7
+ public function getExecutionId(){
8
+ return $this->sExecutionId;
9
+ }
10
+ public function setExecutionId($sExecutionId){
11
+ $this->sExecutionId = $sExecutionId;
12
+ return $this;
13
+ }
14
+ public function createResult(array $aData = array()){
15
+ return BeezupOMOrderListResult::fromArray($aData);
16
+ }
17
+ public function createRequest(array $aData = array()){
18
+ return BeezupOMOrderListRequest::fromArray($aData);
19
+ }
20
+
21
+
22
+
23
+ }
app/code/community/BeezUp/lib/OrderList/BeezupOMOrderListResult.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMOrderListResult extends BeezupOMResult {
4
+
5
+ /**
6
+ * Paginntion result
7
+ * @var BeezupOMPaginationResult
8
+ */
9
+ public $oPaginationResult = null;
10
+
11
+ /**
12
+ * Order headers collection
13
+ * @var array of BeezupOMOrderHeader
14
+ */
15
+ protected $aOrderHeaders = array();
16
+
17
+ public static function fromArray(array $aData = array()){
18
+ $oResult = new BeezupOMOrderListResult();
19
+ if (is_array($aData) && isset($aData['paginationResult']) && isset($aData['orderHeaders'])){
20
+ $oResult->setPaginationResult(BeezupOMPaginationResult::fromArray($aData['paginationResult']));
21
+ foreach ($aData['orderHeaders'] as $aOrderHeader){
22
+ $oResult->addOrderHeader(BeezupOMOrderHeader::fromArray($aOrderHeader));
23
+ }
24
+ }
25
+ return $oResult;
26
+ }
27
+
28
+ /**
29
+ * Gets orders headers
30
+ * @return array of BeezupOMOrderHeader
31
+ */
32
+ public function getOrderHeaders(){
33
+ return $this->aOrderHeaders;
34
+ }
35
+
36
+ /**
37
+ * Adds order header
38
+ * @param BeezupOMOrderHeader $oOrderHeader
39
+ * @return BeezupOMOrderListResult Self
40
+ */
41
+ public function addOrderHeader(BeezupOMOrderHeader $oOrderHeader){
42
+ $this->aOrderHeaders[] = $oOrderHeader;
43
+ return $this;
44
+ }
45
+
46
+ /**
47
+ *
48
+ * @return BeezupOMPaginationResult|null
49
+ */
50
+ public function getPaginationResult(){
51
+ return $this->oPaginationResult;
52
+ }
53
+
54
+ /**
55
+ *
56
+ * @param BeezupOMPaginationResult $oPaginationResult
57
+ * @return BeezupOMOrderListResult Self
58
+ */
59
+ public function setPaginationResult(BeezupOMPaginationResult $oPaginationResult){
60
+ $this->oPaginationResult = $oPaginationResult;
61
+ return $this;
62
+ }
63
+ }
app/code/community/BeezUp/lib/OrderList/BeezupOMPaginationResult.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMPaginationResult extends BeezupOMResult{
4
+
5
+ private $nCurrentNumberOfEntries= null;
6
+ private $nTotalNumberOfPages= null;
7
+ private $nTotalNumberOfEntries= null;
8
+ private $aLinks = array();
9
+
10
+ public function addLink(BeezupOMLink $oLink){
11
+ $this->aLinks[] = $oLink;
12
+ return false;
13
+
14
+ }
15
+
16
+ public function getLinks(){
17
+ return $this->aLinks;
18
+
19
+ }
20
+
21
+ public function getLinkByRel($sRel){
22
+ foreach ($this->getLinks() as $oLink){
23
+ if ($oLink->getRel() === $sRel){
24
+ return $oLink;
25
+ }
26
+ }
27
+ return null;
28
+ }
29
+ /**
30
+ * @return the $nCurrentNumberOfEntries
31
+ */
32
+ public function getCurrentNumberOfEntries() {
33
+ return $this->nCurrentNumberOfEntries;
34
+ }
35
+
36
+ /**
37
+ * @return the $nTotalNumberOfPages
38
+ */
39
+ public function getTotalNumberOfPages() {
40
+ return $this->nTotalNumberOfPages;
41
+ }
42
+
43
+ /**
44
+ * @return the $nTotalNumberOfEntries
45
+ */
46
+ public function getTotalNumberOfEntries() {
47
+ return $this->nTotalNumberOfEntries;
48
+ }
49
+
50
+ /**
51
+ * @param NULL $nCurrentNumberOfEntries
52
+ */
53
+ public function setCurrentNumberOfEntries($nCurrentNumberOfEntries) {
54
+ $this->nCurrentNumberOfEntries = (int)$nCurrentNumberOfEntries;
55
+ return $this;
56
+ }
57
+
58
+ /**
59
+ * @param NULL $nTotalNumberOfPages
60
+ */
61
+ public function setTotalNumberOfPages($nTotalNumberOfPages) {
62
+ $this->nTotalNumberOfPages = (int)$nTotalNumberOfPages;
63
+ return $this;
64
+ }
65
+
66
+ /**
67
+ * @param NULL $nTotalNumberOfEntries
68
+ */
69
+ public function setTotalNumberOfEntries($nTotalNumberOfEntries) {
70
+ $this->nTotalNumberOfEntries = (int)$nTotalNumberOfEntries;
71
+ return $this;
72
+ }
73
+
74
+ public static function fromArray(array $aData = array()){
75
+
76
+ $oPaginationResult = new BeezupOMPaginationResult();
77
+
78
+ $oPaginationResult
79
+ ->setCurrentNumberOfEntries($aData['currentNumberOfEntries'])
80
+ ->setTotalNumberOfEntries($aData['totalNumberOfEntries'])
81
+ ->setTotalNumberOfPages($aData['totalNumberOfPages']);
82
+
83
+ foreach ($aData['links'] as $aLink){
84
+ $oPaginationResult->addLink(BeezupOMLink::fromArray($aLink));
85
+ }
86
+
87
+ return $oPaginationResult;
88
+
89
+ }
90
+
91
+ }
app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdRequest.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMSetOrderIdRequest extends BeezupOMRequest {
4
+
5
+ protected $sMethod = self::METHOD_PATCH;
6
+
7
+ protected $oOrderIdentifier = null;
8
+ protected $oValues = null;
9
+
10
+ public static function fromArray(array $aData = array()){
11
+ $aData = array_change_key_case($aData, CASE_LOWER);
12
+ $oResult = new self();
13
+ if (isset($aData['beezuporderuuid'])) {
14
+ $oResult
15
+ ->setOrderIdentifier(BeezupOMOrderIdentifier::fromArray($aData ? $aData : array()))
16
+ ->setValues(BeezupOMSetOrderIdValues::fromArray(isset($aData['values']) ? $aData['values'] : array()));
17
+ }
18
+ return $oResult;
19
+ }
20
+
21
+ public function toArray(){
22
+ return array(
23
+ 'orderIdentifier' => $this->getOrderIdentifier()->toArray(),
24
+ 'values' => $this->getValues()->toArray()
25
+ );
26
+ }
27
+
28
+ public function setOrderIdentifier(BeezupOMOrderIdentifier $oOrderIdentifier) {
29
+ $this->oOrderIdentifier = $oOrderIdentifier;
30
+ return $this;
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @return BeezupOMOrderIdentifier
36
+ */
37
+ public function getOrderIdentifier() {
38
+ return $this->oOrderIdentifier;
39
+ }
40
+
41
+ public function setValues(BeezupOMSetOrderIdValues $oValues) {
42
+ $this->oValues = $oValues;
43
+ return $this;
44
+ }
45
+
46
+ /**
47
+ *
48
+ * @return BeezupOMSetOrderIdValues
49
+ */
50
+ public function getValues() {
51
+ return $this->oValues;
52
+ }
53
+
54
+ }
app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdResponse.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMSetOrderIdResponse extends BeezupOMResponse {
4
+ public function createResult(array $aData = array()){
5
+ return BeezupOMSetOrderIdResult::fromArray($aData);
6
+ }
7
+ public function createRequest(array $aData = array()){
8
+ return BeezupOMSetOrderIdRequest::fromArray($aData);
9
+ }
10
+
11
+ }
app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdResult.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMSetOrderIdResult extends BeezupOMResult {}
app/code/community/BeezUp/lib/SetOrderId/BeezupOMSetOrderIdValues.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMSetOrderIdValues extends BeezupOMDataHandler {
4
+
5
+ protected $sOrderMerchantOrderId = null;
6
+ protected $sOrderMerchantECommerceSoftwareName = null;
7
+ protected $sOrderMerchantECommerceSoftwareVersion = null;
8
+
9
+
10
+ public static function fromArray(array $aData = array()){
11
+ $aData = array_change_key_case($aData, CASE_LOWER);
12
+ $oResult = new self();
13
+ $oResult
14
+ ->setOrderMerchantOrderId($aData['order_merchantorderid'])
15
+ ->setOrderMerchantECommerceSoftwareName($aData['order_merchantecommercesoftwarename'])
16
+ ->setOrderMerchantECommerceSoftwareVersion($aData['order_merchantecommercesoftwareversion']);
17
+ return $oResult;
18
+ }
19
+
20
+ public function toArray(){
21
+ return array(
22
+ 'Order_MerchantOrderId' => $this->getOrderMerchantOrderId(),
23
+ 'Order_MerchantECommerceSoftwareName' => $this->getOrderMerchantECommerceSoftwareName(),
24
+ 'Order_MerchantECommerceSoftwareVersion' => $this->getOrderMerchantECommerceSoftwareVersion()
25
+ );
26
+ }
27
+ /**
28
+ * @return $sOrderMerchantOrderId
29
+ */
30
+ public function getOrderMerchantOrderId()
31
+ {
32
+ return $this->sOrderMerchantOrderId;
33
+ }
34
+
35
+ /**
36
+ * @return $sOrderMerchantECommerceSoftwareName
37
+ */
38
+ public function getOrderMerchantECommerceSoftwareName()
39
+ {
40
+ return $this->sOrderMerchantECommerceSoftwareName;
41
+ }
42
+
43
+ /**
44
+ * @return $sOrderMerchantECommerceSoftwareVersion
45
+ */
46
+ public function getOrderMerchantECommerceSoftwareVersion()
47
+ {
48
+ return $this->sOrderMerchantECommerceSoftwareVersion;
49
+ }
50
+
51
+ /**
52
+ * @param NULL $sOrderMerchantOrderId
53
+ * @return BeezupOMSetOrderIdValues
54
+ */
55
+ public function setOrderMerchantOrderId($sOrderMerchantOrderId)
56
+ {
57
+ $this->sOrderMerchantOrderId = (string)$sOrderMerchantOrderId;
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * @param NULL $sOrderMerchantECommerceSoftwareName
63
+ * @return BeezupOMSetOrderIdValues
64
+ */
65
+ public function setOrderMerchantECommerceSoftwareName($sOrderMerchantECommerceSoftwareName)
66
+ {
67
+ $this->sOrderMerchantECommerceSoftwareName = $sOrderMerchantECommerceSoftwareName;
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * @param NULL $sOrderMerchantECommerceSoftwareVersion
73
+ * @return BeezupOMSetOrderIdValues
74
+ */
75
+ public function setOrderMerchantECommerceSoftwareVersion($sOrderMerchantECommerceSoftwareVersion)
76
+ {
77
+ $this->sOrderMerchantECommerceSoftwareVersion = $sOrderMerchantECommerceSoftwareVersion;
78
+ return $this;
79
+ }
80
+
81
+ }
app/code/community/BeezUp/lib/Stores/BeezupOMStore.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMStore {
4
+
5
+ protected $sBeezupStoreId = null;
6
+ protected $sBeezUPStoreName = null;
7
+
8
+ /**
9
+ * @return the $sBeezupStoreId
10
+ */
11
+ public function getBeezupStoreId()
12
+ {
13
+ return $this->sBeezupStoreId;
14
+ }
15
+
16
+ /**
17
+ * @param NULL $sBeezupStoreId
18
+ */
19
+ public function setBeezupStoreId($sBeezupStoreId)
20
+ {
21
+ $this->sBeezupStoreId = $sBeezupStoreId;
22
+ return $this;
23
+ }
24
+
25
+ /**
26
+ * @return the $sBeezUPStoreName
27
+ */
28
+ public function getBeezUPStoreName()
29
+ {
30
+ return $this->sBeezUPStoreName;
31
+ }
32
+
33
+ /**
34
+ * @param NULL $sBeezUPStoreName
35
+ */
36
+ public function setBeezUPStoreName($sBeezUPStoreName)
37
+ {
38
+ $this->sBeezUPStoreName = $sBeezUPStoreName;
39
+ return $this;
40
+ }
41
+
42
+ public static function fromArray(array $aData = array()){
43
+ $oValue = new BeezupOMStore();
44
+ foreach ($aData as $sKey=>$mValue){
45
+ $sCamelCaseKey = preg_replace_callback('#_(\S)#', function ($matches) {return strtoupper($matches[1]);}, $sKey);
46
+ $sSetterMethod = 'set' . ucfirst($sCamelCaseKey);
47
+ if (!method_exists($oValue,$sSetterMethod)){
48
+ continue;
49
+ }
50
+ $cCallback = array($oValue,$sSetterMethod);
51
+ if (is_scalar($mValue)){
52
+ call_user_func($cCallback, $mValue);
53
+ } // if
54
+ } // foreach
55
+ return $oValue;
56
+ }
57
+ }
app/code/community/BeezUp/lib/Stores/BeezupOMStoresRequest.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMStoresRequest extends BeezupOMRequest {}
app/code/community/BeezUp/lib/Stores/BeezupOMStoresResponse.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMStoresResponse extends BeezupOMResponse {
4
+
5
+ public function createResult(array $aData = array()){
6
+ return BeezupOMStoresResult::fromArray($aData);
7
+ }
8
+ public function createRequest(array $aData = array()){
9
+ return BeezupOMStoresRequest::fromArray($aData);
10
+ }
11
+
12
+ }
app/code/community/BeezUp/lib/Stores/BeezupOMStoresResult.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BeezupOMStoresResult extends BeezupOMResult {
4
+
5
+ protected $aStores = array();
6
+
7
+
8
+ /**
9
+ * @return the $aValues
10
+ */
11
+ public function getStores()
12
+ {
13
+ return $this->aStores;
14
+ }
15
+
16
+ /**
17
+ * @param multitype: $aValues
18
+ */
19
+ public function setStores($aStores)
20
+ {
21
+ $this->aStores = $aStores;
22
+ return $this;
23
+ }
24
+
25
+ public function addStore(BeezupOMStore $oStore)
26
+ {
27
+ $this->aStores[] = $oStore;
28
+ return $this;
29
+ }
30
+
31
+ public static function fromArray(array $aData = array()){
32
+ $oResult = new BeezupOMStoresResult();
33
+ if (isset($aData['beezUPStores']) && is_array($aData['beezUPStores'])){
34
+ foreach ($aData['beezUPStores'] as $aStore){
35
+ $oResult->addStore(BeezupOMStore::fromArray($aStore));
36
+ }
37
+ }
38
+ return $oResult;
39
+
40
+ }
41
+
42
+
43
+ }
app/code/community/BeezUp/lib/bootstrap.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This is the bootstrap file. Due the lack of proper autoloader, it makes sure that all files are included in good order
5
+ */
6
+
7
+ require_once 'BeezupOMDataHandler.php';
8
+ require_once 'BeezupOMRequestData.php';
9
+ require_once 'BeezupOMResponseData.php';
10
+
11
+ require_once 'Common/BeezupOMSummary.php';
12
+ require_once 'Common/BeezupOMInfoSummary.php';
13
+ require_once 'Common/BeezupOMErrorSummary.php';
14
+ require_once 'Common/BeezupOMSuccessSummary.php';
15
+ require_once 'Common/BeezupOMWarningSummary.php';
16
+ require_once 'Common/BeezupOMInfoSummaries.php';
17
+ require_once 'Common/BeezupOMResponse.php';
18
+ require_once 'Common/BeezupOMRequest.php';
19
+ require_once 'Common/BeezupOMResult.php';
20
+ require_once 'Common/BeezupOMCredential.php';
21
+ require_once 'Common/BeezupOMLink.php';
22
+ require_once 'Common/BeezupOMOrderIdentifier.php';
23
+ require_once 'Common/BeezupOMExpectedOrderChangeMetaInfo.php';
24
+ require_once 'Common/BeezupOMProcessingStatus.php';
25
+
26
+ require_once 'OrderList/BeezupOMOrderListRequest.php';
27
+ require_once 'OrderList/BeezupOMOrderListResponse.php';
28
+ require_once 'OrderList/BeezupOMOrderListResult.php';
29
+ require_once 'OrderList/BeezupOMPaginationResult.php';
30
+ require_once 'OrderList/BeezupOMOrderHeader.php';
31
+
32
+ require_once 'Order/BeezupOMOrderRequest.php';
33
+ require_once 'Order/BeezupOMOrderResponse.php';
34
+ require_once 'Order/BeezupOMOrderResult.php';
35
+ require_once 'Order/BeezupOMOrderItem.php';
36
+
37
+ require_once 'SetOrderId/BeezupOMSetOrderIdRequest.php';
38
+ require_once 'SetOrderId/BeezupOMSetOrderIdResponse.php';
39
+ require_once 'SetOrderId/BeezupOMSetOrderIdResult.php';
40
+ require_once 'SetOrderId/BeezupOMSetOrderIdValues.php';
41
+
42
+ require_once 'OrderHistory/BeezupOMOrderHistoryRequest.php';
43
+ require_once 'OrderHistory/BeezupOMOrderHistoryResponse.php';
44
+ require_once 'OrderHistory/BeezupOMOrderHistoryResult.php';
45
+ require_once 'OrderHistory/BeezupOMOrderChangeReporting.php';
46
+ require_once 'OrderHistory/BeezupOMOrderHarvestReporting.php';
47
+
48
+ require_once 'LOV/BeezupOMLOVRequest.php';
49
+ require_once 'LOV/BeezupOMLOVResponse.php';
50
+ require_once 'LOV/BeezupOMLOVResult.php';
51
+ require_once 'LOV/BeezupOMLOVValue.php';
52
+
53
+ require_once 'Stores/BeezupOMStoresRequest.php';
54
+ require_once 'Stores/BeezupOMStoresResponse.php';
55
+ require_once 'Stores/BeezupOMStoresResult.php';
56
+ require_once 'Stores/BeezupOMStore.php';
57
+
58
+ require_once 'OrderChange/BeezupOMOrderChangeRequest.php';
59
+ require_once 'OrderChange/BeezupOMOrderChangeResult.php';
60
+ require_once 'OrderChange/BeezupOMOrderChangeResponse.php';
61
+ require_once 'OrderChange/BeezupOMOrderChangeMetaInfo.php';
62
+
63
+ require_once 'Harvest/BeezupOMHarvestAbstractReporting.php';
64
+ require_once 'Harvest/BeezupOMHarvestClientReporting.php';
65
+ require_once 'Harvest/BeezupOMHarvestOrderReporting.php';
66
+
67
+ require_once 'BeezupOMRepositoryInterface.php';
68
+ // require_once 'BeezupOMOrderServiceInterface.php';
69
+ require_once 'BeezupOMServiceClientProxy.php';
70
+ require_once 'BeezupOMOrderService.php';
71
+
72
+
app/code/community/BeezUp/sql/beezup_setup/mysql4-install-4.0.0.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $this->getConnection()->addColumn(
5
+ $this->getTable('sales/order_grid'),
6
+ 'beezup_marketplace',
7
+ 'varchar(255) DEFAULT NULL'
8
+
9
+ );
10
+ $this->getConnection()->addColumn(
11
+ $this->getTable('sales/order_grid'),
12
+ 'beezup_name',
13
+ 'varchar(355) NULL'
14
+
15
+ );
16
+ $this->getConnection()->addColumn(
17
+ $this->getTable('sales/order_grid'),
18
+ 'beezup_order',
19
+ 'int (1) DEFAULT 0'
20
+
21
+ );
22
+ $this->getConnection()->addColumn(
23
+ $this->getTable('sales/order_grid'),
24
+ 'beezup_market_order_id',
25
+ 'varchar(255) NULL'
26
+
27
+ );
28
+ $this->getConnection()->addColumn(
29
+ $this->getTable('sales/order_grid'),
30
+ 'beezup_etag',
31
+ 'varchar(355) NULL'
32
+
33
+ );
34
+
35
+ $this->getConnection()->addColumn(
36
+ $this->getTable('sales/order_grid'),
37
+ 'beezup_status',
38
+ 'varchar(355) NULL'
39
+
40
+ );
41
+ $this->getConnection()->addColumn(
42
+ $this->getTable('sales/order_grid'),
43
+ 'beezup_purchase_date',
44
+ 'varchar(355) NULL'
45
+
46
+ );
47
+
48
+ $this->getConnection()->addColumn(
49
+ $this->getTable('sales/order_grid'),
50
+ 'beezup_last_modification_date',
51
+ 'varchar(355) NULL'
52
+
53
+ );
54
+
55
+
56
+ $this->getConnection()->addColumn(
57
+ $this->getTable('sales/order_grid'),
58
+ 'beezup_marketplace_last_modification_date',
59
+ 'varchar(355) NULL'
60
+
61
+ );
62
+
63
+ $this->getConnection()->addColumn(
64
+ $this->getTable('sales/order_grid'),
65
+ 'beezup_total_paid',
66
+ 'varchar(355) NULL'
67
+
68
+ );
69
+
70
+ $this->getConnection()->addColumn(
71
+ $this->getTable('sales/order_grid'),
72
+ 'beezup_comission',
73
+ 'varchar(355) NULL'
74
+
75
+ );
76
+
77
+ $this->getConnection()->addColumn(
78
+ $this->getTable('sales/order_grid'),
79
+ 'beezup_order_id',
80
+ 'varchar(355) NULL'
81
+
82
+ );
83
+
84
+ $this->getConnection()->addColumn(
85
+ $this->getTable('sales/order_grid'),
86
+ 'beezup_marketplace_status',
87
+ 'varchar(355) NULL'
88
+
89
+ );
90
+
91
+
92
+ $this->getConnection()->addColumn(
93
+ $this->getTable('sales/order_grid'),
94
+ 'beezup_comission',
95
+ 'varchar(355) NULL'
96
+
97
+ );
98
+
99
+
100
+ $this->getConnection()->addColumn(
101
+ $this->getTable('sales/quote_address'),
102
+ 'beezup_fee',
103
+ 'decimal(10,2) NOT NULL DEFAULT 0'
104
+
105
+ );
106
+
107
+ $dir = Mage::getModuleDir("etc", "BeezUp");
108
+ $dir = str_replace("etc", "log", $dir);
109
+
110
+ $io = new Varien_Io_File();
111
+ $io->checkAndCreateFolder($dir);
112
+
113
+ $oLastSynchronizationDate = new DateTime ( 'now', new DateTimeZone ( 'UTC' ));
114
+ $helper = Mage::getModel('core/config');
115
+ $helper->saveConfig('beezup/marketplace/syncro_time',$oLastSynchronizationDate->getTimestamp());
116
+
117
+
118
+ $helper->saveConfig('beezup/marketplace/status_new', 'pending');
119
+ $helper->saveConfig('beezup/marketplace/status_progress', 'processing');
120
+ $helper->saveConfig('beezup/marketplace/status_cancelled', 'canceled');
121
+ $helper->saveConfig('beezup/marketplace/status_aborted', 'holded');
122
+ $helper->saveConfig('beezup/marketplace/status_closed', 'closed');
123
+ $helper->saveConfig('beezup/marketplace/status_shipped', 'complete');
124
+
125
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/beezup_salestab.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_sales_order_view>
4
+ <reference name="sales_order_tabs">
5
+ <action method="addTab"><name>Beezup Sales Tab</name><block>beezup/Adminhtml_Sales_Order_View_Tab_Custom</block></action>
6
+ </reference>
7
+ </adminhtml_sales_order_view>
8
+ </layout>
app/design/adminhtml/default/default/template/beezup/custom.phtml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="entry-edit">
2
+ <div class="entry-edit-head">
3
+ <h4><?php echo $this->__('BeezUP Info'); ?></h4>
4
+ </div>
5
+ <div class="fieldset fieldset-wide">
6
+
7
+ <?php
8
+ $order = $this->getOrder();
9
+
10
+
11
+
12
+ $resource = Mage::getSingleton('core/resource');
13
+ $readConnection = $resource->getConnection('core_read');
14
+ $table = $resource->getTableName('sales/order_grid');
15
+ $query = 'SELECT * FROM ' . $table . ' WHERE beezup_order = 1 and entity_id = \''
16
+ . $order->getId() . '\' LIMIT 1';
17
+ $results = $readConnection->fetchAll($query);
18
+ //var_dump($results);
19
+ if($results[0]['beezup_order'] == 1) {
20
+
21
+ $date = new DateTime($results[0]['beezup_marketplace_last_modification_date']);
22
+ $beezup_marketplace_last_modification_date = $date->format('d-m-Y H:i:s'). " (UTC Time)";
23
+
24
+ $date2 = new DateTime($results[0]['beezup_purchase_date']);
25
+ $beezup_purchase_date = $date2->format('d-m-Y H:i:s'). " (UTC Time)";
26
+
27
+ $date3 = new DateTime($results[0]['beezup_last_modification_date']);
28
+ $beezup_last_modification_date = $date3->format('d-m-Y H:i:s'). " (UTC Time)";
29
+
30
+ echo "<strong>".Mage::helper('beezup')->__('BeezUP Order Id:')." </strong> ".$results[0]['beezup_order_id']."<br>";
31
+ echo "<strong>".Mage::helper('beezup')->__('BeezUP Status:')." </strong> ".$results[0]['beezup_status']."<br>";
32
+ echo "<strong>".Mage::helper('beezup')->__('BeezUP Last Modification Date:')." </strong> ".$beezup_last_modification_date."<br>";
33
+ echo "<strong>".Mage::helper('beezup')->__('Marketplace:')." </strong> ".$results[0]['beezup_marketplace']."<br>";
34
+ echo "<strong>".Mage::helper('beezup')->__('Marketplace Order Id:')." </strong> ".$results[0]['beezup_market_order_id']."<br>";
35
+ echo "<strong>".Mage::helper('beezup')->__('Marketplace Status:')." </strong> ".$results[0]['beezup_marketplace_status']."<br>";
36
+ echo "<strong>".Mage::helper('beezup')->__('BeezUP Purchase Date: ')."</strong> ".$beezup_purchase_date ."<br>";
37
+ echo "<strong>".Mage::helper('beezup')->__('Marketplace Last Modification Date:')." </strong> ".$beezup_marketplace_last_modification_date."<br>";
38
+ echo "<strong>".Mage::helper('beezup')->__('BeezUP Total Paid: ')."</strong> ".$results[0]['beezup_total_paid']."<br>";
39
+ if((int)$results[0]['beezup_comission'] > 0) {
40
+ echo "<strong>".Mage::helper('beezup')->__('BeezUP Total Commission:')." </strong> ".$results[0]['beezup_comission']."<br>";
41
+ }
42
+ echo "<strong>".Mage::helper('beezup')->__('BeezUP Order Link:')." </strong> <a href='https://go.beezup.com/OrderManagement/Informations?BeezUPOrderUUId=".$results[0]['beezup_order_id']."&MarketplaceTechnicalCode=".$results[0]['beezup_marketplace']."&AccountId=".$results[0]['beezup_name']."' target='_blank'>https://go.beezup.com/OrderManagement/Informations?BeezUPOrderUUId=".$results[0]['beezup_order_id']."&MarketplaceTechnicalCode=".$results[0]['beezup_marketplace']."&AccountId=".$results[0]['beezup_name']."</a><br>";
43
+ } else {
44
+
45
+ echo Mage::helper('beezup')->__('No data here, since it\'s not an order coming from BeezUP');
46
+ }
47
+
48
+ ?>
49
+ </div>
50
+ </div>
app/locale/en_US/BeezUp.csv CHANGED
@@ -1,70 +1,109 @@
1
- Short Description,Short Description
2
- Description,Description
3
- Meta Description,Meta Description
4
- Product description,Product description
5
- Excl. Tax,Excl. Tax
6
- Incl. Tax,Incl. Tax
7
- No,No
8
- Yes,Yes
9
- In Stock,In Stock
10
- Out of Stock,Out of Stock
11
- Tracking,Tracking
12
- Catalog Flow,Catalog Flow
13
- Enabled,Enabled
14
- Store ID,Store ID
15
- Calculate product margin,Calculate product margin
16
- VAT Rates,VAT Rates
17
- Logs,Logs
18
- www.yoursite.com/beezup/catalog/xml,www.yoursite.com/beezup/catalog/xml
19
- BeezUP Server IP address,BeezUP Server IP address
20
- Key,Key
21
- Out of stock products,Out of stock products
22
- Shipping (Incl. Tax),Shipping (Incl. Tax)
23
- Catalog Price,Catalog Price
24
- Delivery Time if Product in Stock,Delivery Time if Product in Stock
25
- Delivery Time if Product out of Stock,Delivery Time if Product out of Stock
26
- Specific Attributes,Specific Attributes
27
- The field cost must be indicated for all products,The field cost must be indicated for all products
28
- Product Price and Shipping Excl. Tax or Incl. Tax in catalog,Product Price and Shipping Excl. Tax or Incl. Tax in catalog
29
- Enable tracker logs (var/log/beezup.log),Enable tracker logs (var/log/beezup.log)
30
- Only this IP address will be able to read the flow (leave empty to disable the restriction),Only this IP address will be able to read the flow (leave empty to disable the restriction)
31
- Protects the flow by a unique key (Eg: 85ds6f7): www.yoursite.com/beezup/catalog/xml/key/85ds6f7/,Protects the flow by a unique key (Eg: 85ds6f7): www.yoursite.com/beezup/catalog/xml/key/85ds6f7/
32
- Product Price Excl. Tax or Incl. Tax in catalog,Product Price Excl. Tax or Incl. Tax in catalog
33
- Enter eg 1-2 for 1 to 2 days,Enter eg 1-2 for 1 to 2 days
34
- Enter eg 6-8 for 6 to 8 days,Enter eg 6-8 for 6 to 8 days
35
- Field Separator,Field Separator
36
- Get your Store ID from My trackers page in your BeezUP account,Get your Store ID from My trackers page in your BeezUP account
37
- Only for CSV file,Only for CSV file
38
- Use Catalog Price Rules,Use Catalog Price Rules
39
- Let off if Catalog Price Rules are not used,Let off if Catalog Price Rules are not used
40
- Debug Mode,Debug Mode
41
- Limit the number of products,Limit the number of products
42
- Table Rates,Table Rates
43
- Use Table Rates (only Weight vs. Destination),Use Table Rates (only Weight vs. Destination)
44
- Add Byte Order Mark (BOM),Add Byte Order Mark (BOM)
45
- Tag position,Tag position
46
- Head,Head
47
- Before body end,Before body end
48
- b_unique_id,unique_id
49
- b_sku,sku
50
- b_title,title
51
- b_description,description
52
- b_price,price
53
- b_product_url,product_url
54
- b_product_image,product_image
55
- b_shipping,shipping
56
- b_availability,availability
57
- b_qty,qty
58
- b_delivery,delivery
59
- b_regular_price,regular_price
60
- b_category_%s,category_%s
61
- b_weight,weight
62
- Total orders amount,Total orders amount
63
- Excl. Tax - without shipping costs,Excl. Tax - without shipping costs
64
- Excl. Tax - with shipping costs,Excl. Tax - with shipping costs
65
- Incl. Tax - without shipping costs,Incl. Tax - without shipping costs
66
- Incl. Tax - with shipping costs,Incl. Tax - with shipping costs
67
- Filter out of stock products,Filter out of stock products
68
- hours,hours
69
- hours,hour
70
- minutes,minutes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "--Please Select--","--Please Select--"
2
+ "1 hour","1 hour"
3
+ "12 hours","12 hours"
4
+ "2 hours","2 hours"
5
+ "24 hours","24 hours"
6
+ "30 minutes","30 minutes"
7
+ "4 hours","4 hours"
8
+ "8 hours","8 hours"
9
+ "API BeezUP Connection status:","API BeezUP Connection status:"
10
+ "Add New Attribute","Add New Attribute"
11
+ "Allow creating orders with non available products","Allow creating orders with non available products"
12
+ BeezUP,BeezUP
13
+ "BeezUP Info","BeezUP Info"
14
+ "BeezUP Last Modification Date:","BeezUP Last Modification Date:"
15
+ "BeezUP Order Id:","BeezUP Order Id:"
16
+ "BeezUP Order Link:","BeezUP Order Link:"
17
+ "BeezUP Purchase Date: ","BeezUP Purchase Date: "
18
+ "BeezUP Server IP address","BeezUP Server IP address"
19
+ "BeezUP Status:","BeezUP Status:"
20
+ "BeezUP Total Commission:","BeezUP Total Commission:"
21
+ "BeezUP Total Paid: ","BeezUP Total Paid: "
22
+ "Beezup Info","Beezup Info"
23
+ "Beezup Order","Beezup Order"
24
+ "Beezup Orders","Beezup Orders"
25
+ "Before body end","Before body end"
26
+ Bom,Bom
27
+ "Cache delay","Cache delay"
28
+ "Calculate product margin","Calculate product margin"
29
+ "Catalog Flow","Catalog Flow"
30
+ "Catalog Price","Catalog Price"
31
+ Change,Change
32
+ "Cron Call","Cron Call"
33
+ "Debug Mode","Debug Mode"
34
+ "Default payment ","Default payment "
35
+ "Delivery Time if Product in Stock","Delivery Time if Product in Stock"
36
+ "Delivery Time if Product out of Stock","Delivery Time if Product out of Stock"
37
+ Description,Description
38
+ Disable,Disable
39
+ Enable,Enable
40
+ Enabled,Enabled
41
+ "Excl. Tax","Excl. Tax"
42
+ "Excl. Tax - with shipping costs","Excl. Tax - with shipping costs"
43
+ "Excl. Tax - without shipping costs","Excl. Tax - without shipping costs"
44
+ "Export all available pictures","Export all available pictures"
45
+ "Filter out of stock products","Filter out of stock products"
46
+ Head,Head
47
+ "In Stock","In Stock"
48
+ "Incl. Tax","Incl. Tax"
49
+ "Incl. Tax - with shipping costs","Incl. Tax - with shipping costs"
50
+ "Incl. Tax - without shipping costs","Incl. Tax - without shipping costs"
51
+ Key,Key
52
+ "Last synchronization time :","Last synchronization time :"
53
+ Logs,Logs
54
+ "Manual orders retrieval link:","Manual orders retrieval link:"
55
+ Marketplace,Marketplace
56
+ "Marketplace Last Modification Date:","Marketplace Last Modification Date:"
57
+ "Marketplace Order Id","Marketplace Order Id"
58
+ "Marketplace Order Id:","Marketplace Order Id:"
59
+ "Marketplace Status:","Marketplace Status:"
60
+ Marketplace:,Marketplace:
61
+ "Meta Description","Meta Description"
62
+ "NOT OK","NOT OK"
63
+ No,No
64
+ "No data here, since it\'s not an order coming from BeezUP","No data here, since it\'s not an order coming from BeezUP"
65
+ None,None
66
+ "Not Syncing","Not Syncing"
67
+ OK,OK
68
+ Orders,Orders
69
+ "Out of Stock","Out of Stock"
70
+ "Product description","Product description"
71
+ Sales,Sales
72
+ "Select Value...","Select Value..."
73
+ "Shipping (Incl. Tax)","Shipping (Incl. Tax)"
74
+ "Short Description","Short Description"
75
+ "Special Fee","Special Fee"
76
+ "Specific Attributes","Specific Attributes"
77
+ "Store ID","Store ID"
78
+ "Sync Status:","Sync Status:"
79
+ Syncing,Syncing
80
+ "Table Rates","Table Rates"
81
+ "Total orders amount","Total orders amount"
82
+ Tracking,Tracking
83
+ "Use Catalog Price Rules","Use Catalog Price Rules"
84
+ "User Id","User Id"
85
+ "User Token","User Token"
86
+ "VAT Rates","VAT Rates"
87
+ Yes,Yes
88
+ "You are viewing Beezup sales order grid.","You are viewing Beezup sales order grid."
89
+ "You are viewing a) case of order grid.","You are viewing a) case of order grid."
90
+ "You are viewing default sales order grid.","You are viewing default sales order grid."
91
+ b_availability,b_availability
92
+ b_category_%s,b_category_%s
93
+ b_delivery,b_delivery
94
+ b_description,b_description
95
+ b_price,b_price
96
+ b_product_category_,b_product_category_
97
+ b_product_image,b_product_image
98
+ b_product_url,b_product_url
99
+ b_qty,b_qty
100
+ b_regular_price,b_regular_price
101
+ b_shipping,b_shipping
102
+ b_sku,b_sku
103
+ b_title,b_title
104
+ b_unique_id,b_unique_id
105
+ b_weight,b_weight
106
+ parent_id,parent_id
107
+ parent_or_child,parent_or_child
108
+ url_image,url_image
109
+ variation-theme,variation-theme
app/locale/fr_FR/BeezUp.csv CHANGED
@@ -1,71 +1,133 @@
1
- Short Description,Description courte
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  Description,Description longue
3
- Meta Description,Meta description
4
- Product description,Description du produit
 
 
 
 
5
  Excl. Tax,HT
 
 
 
 
 
 
 
 
 
 
6
  Incl. Tax,TTC
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  No,Non
8
- Yes,Oui
9
- In Stock,En stock
 
 
 
 
 
 
 
10
  Out of Stock,Hors stock
11
- Tracking,Tracking
12
- Catalog Flow,Flux
13
- Enabled,Activer
14
- Store ID,Store ID
15
- Calculate product margin,Calculer la marge
16
- VAT Rates,Taux TVA
17
- Logs,Logs
18
- www.yoursite.com/beezup/catalog/xml,www.votreboutique.com/beezup/catalog/xml
19
- BeezUP Server IP address,Adresse IP du serveur BeezUP
20
- Key,Cl&eacute;
21
  Out of stock products,Produits hors stock
22
- Shipping (Incl. Tax),Frais de port (TTC)
23
- Catalog Price,Prix catalogue
24
- Delivery Time if Product in Stock,D&eacute;lais de livraison si produit en stock
25
- Delivery Time if Product out of Stock,D&eacute;lais de livraison si produit hors stock
26
- Specific Attributes,Attributs sp&eacute;cifiques
27
- The field cost must be indicated for all products,Le champ co&ucirc;t doit &ecirc;tre renseign&eacute; pour l&apos;ensemble des produits
28
  Product Price and Shipping Excl. Tax or Incl. Tax in catalog,Prix produits et frais de port saisis en HT ou TTC
29
- Enable tracker logs (var/log/beezup.log),Activer les logs du tracker (var/log/beezup.log)
30
- Only this IP address will be able to read the flow (leave empty to disable the restriction),Seule cette adresse IP sera en mesure de lire le flux (laisser vide pour d&eacute;sactiver la restriction)
31
- Protects the flow by a unique key (Eg: 85ds6f7): www.yoursite.com/beezup/catalog/xml/key/85ds6f7/,Prot&eacute;ge le flux par une cl&eacute; unique (Ex : 85ds6f7) : www.votresite.com/beezup/catalog/xml/key/85ds6f7/
32
  Product Price Excl. Tax or Incl. Tax in catalog,Prix produits saisis en HT ou TTC
33
- Enter eg 1-2 for 1 to 2 days,Saisissez par exemple 1-2 pour 1 &agrave; 2 jours
34
- Enter eg 6-8 for 6 to 8 days,Saisissez par exemple 6-8 pour 6 &agrave; 8 jours
35
- Field Separator,S&eacute;parateur de champs
36
- Get your Store ID from My trackers page in your BeezUP account,R&eacute;cup&eacute;rez votre Store ID depuis la page &apos;Mes trackers&apos; de votre compte BeezUP
37
- Only for CSV file,Uniquement pour le fichier CSV
38
- Use Catalog Price Rules,Inclure les r&eacute;gles de prix catalogue
39
- Let off if Catalog Price Rules are not used,D&eacute;sactiver si les r&eacute;gles de prix catalogue ne sont pas utlis&eacute;es
40
- Debug Mode,Mode Debug
41
- Limit the number of products,Limiter le nombre de produits
 
42
  Table Rates,Frais de port poids par destination
43
- Use Table Rates (only Weight vs. Destination),Utiliser le mode tarification poids par destination pour le calcul des frais de port
44
- Add Byte Order Mark (BOM),Ajouter le Byte Order Mark (activer de pr&eacute;f&eacute;rence)
45
  Tag position,Position du tag
46
- Head,En-t&ecirc;te (head)
47
- Before body end,En bas de page (body)
48
- b_unique_id,identifiant_unique
49
- b_sku,sku
50
- b_title,titre
51
- b_description,description
52
- b_price,prix
53
- b_product_url,url_produit
54
- b_product_image,url_image
55
- b_shipping,port
56
- b_availability,disponibilite
57
- b_qty,qte
58
- b_delivery,delai_de_livraison
59
- b_regular_price,prix_barre
60
- b_category_%s,categorie_%s
61
- b_weight,poids
62
  Total orders amount,Montant total des commandes
63
- Excl. Tax - without shipping costs,HT - sans frais de port
64
- Excl. Tax - with shipping costs,HT - avec frais de port
65
- Incl. Tax - without shipping costs,TTC - sans frais de port
66
- Incl. Tax - with shipping costs,TTC - avec frais de port
67
- Filter out of stock products,Filtrer les produits hors stock
68
- hour,heure
69
- minutes,minutes
70
- hours,heures
71
- Export all available pictures,Exporter toutes les images disponibles
 
 
 
 
 
 
 
1
+ Add Byte Order Mark (BOM),"Ajouter le Byte Order Mark (activer de pr&eacute;f&eacute;rence)"
2
+ 1 hour,1 heure
3
+ 12 hours,12 heures
4
+ 2 hours,2 heures
5
+ 24 hours,24 heures
6
+ 30 minutes,30 minutes
7
+ 4 hours,4 heures
8
+ 8 hours,8 heures
9
+ Add New Attribute,Ajouter un nouvel attribut
10
+ Allow creating orders with non available products (Beta Version),Permettre l'enregistrement des commandes avec des produits hors stock (Beta Version)
11
+ API BeezUP Connection status:,Statut connexion API BeezUP:
12
+ b_availability,disponibilite
13
+ b_category_%s,categorie_%s
14
+ b_delivery,delai_de_livraison
15
+ b_description,description
16
+ b_price,prix
17
+ b_product_category_,categorie_produit
18
+ b_product_image,url_image
19
+ b_product_url,url_produit
20
+ b_qty,qte
21
+ b_regular_price,prix_barre
22
+ b_shipping,port
23
+ b_sku,sku
24
+ b_title,titre
25
+ b_unique_id,identifiant_unique
26
+ b_weight,poids
27
+ BeezUP,BeezUP
28
+ BeezUP Info,Infos BeezUP
29
+ Beezup Info,Infos BeezUP
30
+ BeezUP Last Modification Date:,Derniere Date de modification BeezUP
31
+ Beezup Order,Commande BeezUP
32
+ BeezUP Order Id:,BeezUP Order ID:
33
+ BeezUP Order Link:,Lien vers commande BeezUP
34
+ Beezup Orders,Commandes BeezUP
35
+ BeezUP Purchase Date: ,Date d'achat:
36
+ BeezUP Server IP address,Adresse IP du serveur BeezUP
37
+ BeezUP Status:,Statut BeezUP:
38
+ BeezUP Total Commission:,Commission Marketplace:
39
+ BeezUP Total Paid: ,"Montant pay&eacute; total:"
40
+ Before body end,En bas de page (body)
41
+ Bom,Bom
42
+ Cache delay,"Validit&eacute; du cache"
43
+ Calculate product margin,Calculer la marge
44
+ Catalog Flow,Flux
45
+ Catalog Price,Prix catalogue
46
+ Change,Modifier
47
+ Cron Call,Lien tache CRON
48
+ Debug Mode,Mode Debug
49
+ Default payment ,Mode de paiement par defaut
50
+ Delivery Time if Product in Stock,"D&eacute;lais de livraison si produit en stock"
51
+ Delivery Time if Product out of Stock,"D&eacute;lais de livraison si produit hors stock"
52
  Description,Description longue
53
+ Disable,Desactiver
54
+ Enable,Activer
55
+ Enable tracker logs (var/log/beezup.log),Activer les logs du tracker (var/log/beezup.log)
56
+ Enabled,Activer
57
+ Enter eg 1-2 for 1 to 2 days,"Saisissez par exemple 1-2 pour 1 &agrave; 2 jours"
58
+ Enter eg 6-8 for 6 to 8 days,"Saisissez par exemple 6-8 pour 6 &agrave; 8 jours"
59
  Excl. Tax,HT
60
+ Excl. Tax - with shipping costs,HT - avec frais de port
61
+ Excl. Tax - without shipping costs,HT - sans frais de port
62
+ Export all available pictures,Exporter toutes les images disponibles
63
+ Field Separator,"S&eacute;parateur de champs"
64
+ Filter out of stock products,Filtrer les produits hors stock
65
+ Get your Store ID from My trackers page in your BeezUP account,"R&eacute;cup&eacute;rez votre Store ID depuis la page &apos;Mes trackers&apos; de votre compte BeezUP"
66
+ Head,"En-t&ecirc;te (head)"
67
+ hour,heure
68
+ hours,heures
69
+ In Stock,En stock
70
  Incl. Tax,TTC
71
+ Incl. Tax - with shipping costs,TTC - avec frais de port
72
+ Incl. Tax - without shipping costs,TTC - sans frais de port
73
+ Key,"Cl&eacute;"
74
+ Last synchronization time :,Derniere date synchronisation:
75
+ Let off if Catalog Price Rules are not used,"D&eacute;sactiver si les r&eacute;gles de prix catalogue ne sont pas utlis&eacute;es"
76
+ Limit the number of products,Limiter le nombre de produits
77
+ Logs,Logs
78
+ Manual orders retrieval link:,"Lien de r&eacute;cup&eacute;ration manuelle des commandes:"
79
+ Marketplace,Marketplace
80
+ Marketplace Last Modification Date:,Date de derniere modification Marketplace :
81
+ Marketplace Order Id,Marketplace Order ID
82
+ Marketplace Order Id:,Marketplace Order ID:
83
+ Marketplace Status:,Statut Marketplace:
84
+ Marketplace:,Marketplace:
85
+ Meta Description,Meta description
86
+ minutes,minutes
87
  No,Non
88
+ No,Non
89
+ No data here,"Aucune donn&eacute;e ici"
90
+ None,Aucun
91
+ NOT OK,NOT OK
92
+ Not Syncing,No Sync
93
+ OK,OK
94
+ Only for CSV file,Uniquement pour le fichier CSV
95
+ Only this IP address will be able to read the flow (leave empty to disable the restriction),"Seule cette adresse IP sera en mesure de lire le flux (laisser vide pour d&eacute;sactiver la restriction)"
96
+ Orders,Commandes BeezUP
97
  Out of Stock,Hors stock
 
 
 
 
 
 
 
 
 
 
98
  Out of stock products,Produits hors stock
99
+ parent_id,parent_id
100
+ parent_or_child,parent_or_child
101
+ Product description,Description du produit
 
 
 
102
  Product Price and Shipping Excl. Tax or Incl. Tax in catalog,Prix produits et frais de port saisis en HT ou TTC
 
 
 
103
  Product Price Excl. Tax or Incl. Tax in catalog,Prix produits saisis en HT ou TTC
104
+ Protects the flow by a unique key (Eg: 85ds6f7): www.yoursite.com/beezup/catalog/xml/key/85ds6f7/,"Prot&eacute;ge le flux par une cl&eacute; unique (Ex : 85ds6f7) : www.votresite.com/beezup/catalog/xml/key/85ds6f7/"
105
+ Sales,Ventes
106
+ Select Value...,"S&eacute;lectionner une valeur..."
107
+ Shipping (Incl. Tax),Frais de port (TTC)
108
+ Short Description,Description courte
109
+ Special Fee,Co�ts de gestion
110
+ Specific Attributes,"Attributs sp&eacute;cifiques"
111
+ Store ID,Store ID
112
+ Sync Status:,Statut de synchronisation:
113
+ Syncing,Syncing
114
  Table Rates,Frais de port poids par destination
 
 
115
  Tag position,Position du tag
116
+ The field cost must be indicated for all products,"Le champ co&ucirc;t doit &ecirc;tre renseign&eacute; pour l&apos;ensemble des produits"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  Total orders amount,Montant total des commandes
118
+ Tracking,Tracking
119
+ url_image,url_image
120
+ Use Catalog Price Rules,"Inclure les r&eacute;gles de prix catalogue"
121
+ Use Table Rates (only Weight vs. Destination),Utiliser le mode tarification poids par destination pour le calcul des frais de port
122
+ User Id,User Id
123
+ User Token,User Token
124
+ variation-theme,variation-theme
125
+ VAT Rates,Taux TVA
126
+ www.yoursite.com/beezup/catalog/xml,www.votreboutique.com/beezup/catalog/xml
127
+ www.yoursite.com/beezup/catalog/xml,www.votreboutique.com/beezup/catalog/xml
128
+ Yes,Oui
129
+ You are viewing a) case of order grid.,You are viewing a) case of order grid.
130
+ You are viewing Beezup sales order grid.,You are viewing Beezup sales order grid.
131
+ You are viewing default sales order grid.,You are viewing default sales order grid.
132
+ Create products if not matched - should always be disabled in production shop, Permet la cr&eacute;ation des produits si aucune correspondance n'est trouv&eacute;e - doit toujours &ecirc;tre inactif sur les sites en production
133
+ For full logs see here:, Pour des logs complets voir ici:
package.xml CHANGED
@@ -1,20 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BeezUP_Module_feed_and_tracker</name>
4
- <version>3.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Main features : &#xD;
10
  - Generate XML catalogue feed&#xD;
11
- - Install BeezUP sales tracking system</summary>
 
12
  <description>&lt;p&gt;BeezUP is a web solution allowing any stores to easily publish their products on more than 1000 networks around the world : Price Comparison Engines, Marketplaces, Affiliation Networks, Cashback websites, etc. More than 15 countries are today covered.&lt;/p&gt;&#xD;
13
  &#xD;
14
  &#xD;
15
  &#xD;
16
  &lt;p&gt;This module generates the XML catalogue feed and the sales tracker that you need to work with BeezUP&lt;/p&gt;&#xD;
17
  &#xD;
 
18
  &#xD;
19
  &#xD;
20
  &lt;p&gt;Details :&lt;/p&gt;&#xD;
@@ -39,12 +41,13 @@ After Set-up, the following files are added :&lt;/p&gt;&#xD;
39
  &lt;/ul&gt;&#xD;
40
  &#xD;
41
  &lt;p&gt;By BeezUP &amp; Magentix&lt;/p&gt;</description>
42
- <notes>New feature :&#xD;
43
- &gt; Export all available pictures&#x200F;</notes>
 
44
  <authors><author><name>BeezUP</name><user>BeezUP</user><email>charles@beezup.com</email></author></authors>
45
- <date>2015-04-10</date>
46
- <time>14:45:06</time>
47
- <contents><target name="magecommunity"><dir name="BeezUp"><dir name="Block"><file name="Tracking.php" hash="455b06ca7208bab816f227980ff97f67"/><file name="Xml.php" hash="bf24d6e2b8d41800fe763f3b7f63c215"/></dir><dir name="Helper"><file name="Data.php" hash="1a40dbf0ff07f30c8c6be624da058e0b"/></dir><dir name="Model"><file name="Observer.php" hash="434ced3bc78542186217c92c5df9e394"/><file name="Products.php" hash="064f39e840485fc8400b3d8c6a4c7e09"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="4bba8f38763988edf7940df0b8bdce92"/><file name="Cache.php" hash="f9d206faa23746ed4f470b1fe6fb37f6"/><file name="Description.php" hash="ab4cc7e3c931544aff38d3bc2cd517dd"/><file name="Images.php" hash="dbfb6c757476ffa25b9181869a576766"/><file name="Montant.php" hash="3460701acf11007082c88f8ee9bef6fa"/><file name="Position.php" hash="bed34c5746369dc5d9ea9f6589ac6c74"/><file name="Price.php" hash="2c07ae280bf2f6e073fa738fad4e03e3"/></dir></dir></dir></dir><dir name="controllers"><file name="CatalogController.php" hash="cfd53d5adb5c48185cc502ac031d793f"/></dir><dir name="etc"><file name="config.xml" hash="8e78da6052fd4d0911afd4228fed83d9"/><file name="system.xml" hash="d7c255066173358b019c812681c20ab4"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="BeezUp.xml" hash="93df32f86c55b57363b9abc62cf68474"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="BeezUp.csv" hash="86cddf2dacebf3f754316ad2435d327d"/></dir><dir name="en_US"><file name="BeezUp.csv" hash="ae6d24a6c16ae3b17ce5d9bfb7b55234"/></dir></target><target name="magelocal"><dir name="es_ES"><file name="BeezUp.csv" hash=""/></dir></target></contents>
48
  <compatible/>
49
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
50
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BeezUP_Module_feed_and_tracker</name>
4
+ <version>4.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Main features : &#xD;
10
  - Generate XML catalogue feed&#xD;
11
+ - Install BeezUP sales tracking system&#xD;
12
+ - Retrieve orders from Marketplaces</summary>
13
  <description>&lt;p&gt;BeezUP is a web solution allowing any stores to easily publish their products on more than 1000 networks around the world : Price Comparison Engines, Marketplaces, Affiliation Networks, Cashback websites, etc. More than 15 countries are today covered.&lt;/p&gt;&#xD;
14
  &#xD;
15
  &#xD;
16
  &#xD;
17
  &lt;p&gt;This module generates the XML catalogue feed and the sales tracker that you need to work with BeezUP&lt;/p&gt;&#xD;
18
  &#xD;
19
+ &lt;p&gt;It also allows you to retrieve your orders coming from Marketplaces directly within your Magento Order List.&lt;/p&gt;&#xD;
20
  &#xD;
21
  &#xD;
22
  &lt;p&gt;Details :&lt;/p&gt;&#xD;
41
  &lt;/ul&gt;&#xD;
42
  &#xD;
43
  &lt;p&gt;By BeezUP &amp; Magentix&lt;/p&gt;</description>
44
+ <notes>New features :&#xD;
45
+ &gt; Export Orders from Marketplaces&#xD;
46
+ &gt; Fixed bug in category management</notes>
47
  <authors><author><name>BeezUP</name><user>BeezUP</user><email>charles@beezup.com</email></author></authors>
48
+ <date>2015-06-10</date>
49
+ <time>16:35:48</time>
50
+ <contents><target name="magecommunity"><dir name="BeezUp"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="cf7754624d51f53fb024353b135e0fb3"/></dir><file name="Grid.php" hash="f3abc6748cec60dcce610b2cfe6af32c"/><dir name="Invoice"><file name="Totals.php" hash="ac065cd586fd2534de7e12762ab9b335"/></dir><file name="Totals.php" hash="5972281aa467d63da56a297a8df3da55"/><dir name="View"><dir name="Tab"><file name="Custom.php" hash="9c561365287993c70ba679afbfd4f7fb"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="Attributes.php" hash="a504265fe4dc2df69b311d8219c88fbf"/><file name="Button.php" hash="476b33034b0c7d36e1bbd85f38b841db"/><file name="Childgroup.php" hash="388d3dee8f9d66a56c43c2790a44b45a"/><file name="Credentials.php" hash="b86f361800bebfd6fcf3564d9fe87c95"/><file name="Cron.php" hash="e1d47b095623593beb7f166d2ad7fecc"/><file name="Filter.php" hash="ad7ba55e18c080e25a08309dc428402a"/><file name="Log.php" hash="56f4877f21e94d046f9d3eac3ae1b254"/><file name="Manualcron.php" hash="cbac01f15d256a43f0388f58449bffd0"/><file name="Stores.php" hash="4297f4c94f136bb9778c9ddcd0cb336c"/><file name="Syncstatus.php" hash="49164eb19331aadabc0581472cd3c567"/><file name="Time.php" hash="ac5c2e4a40e9c6ff68cea1097dfa1e7b"/></dir></dir></dir><file name="Order.php" hash="ba4a66b3b8d13713fa4235eb5aaefe9d"/><file name="Tracking.php" hash="e6dcd6b89e782b2eb6cb83abfb1b7f56"/><file name="Xml.php" hash="80663a2bdc71b24253504344c90d430a"/></dir><dir name="Helper"><file name="Data.php" hash="1cbbd163fea65ae82224a11c95d90e03"/></dir><dir name="Model"><file name="Flatrate.php" hash="27d078203781d9b923605f685bfe5c25"/><file name="Observer.php" hash="3bcb925df1965ef23ef1fb08ab64de08"/><file name="Products.php" hash="54df5fb3a6f15044ef4466085f820a30"/><dir name="Quote"><file name="Item.php" hash="13cef88e165932990fa032b57e8905a0"/></dir><dir name="Sales"><dir name="Order"><dir name="Pdf"><file name="Invoice.php" hash="9eaf28084db176b41c6007da3d529d18"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Attributes.php" hash="174aee475c6a6a8b0b4f2e8e076c6a25"/><file name="Credentials.php" hash="5c5ca91b68bebe3a0354a9b22f5f44f3"/><file name="Time.php" hash="a70e4d748a9b300ec7b718168fa4d5f8"/><file name="Token.php" hash="60247c8b4d5889433ae1f92e998cc889"/></dir><dir name="Source"><file name="Attributes.php" hash="878b6ed9c50afee368f2688a1ff56f5e"/><file name="Availableproducts.php" hash="d9d4b3705f5fbd98efbae0289a1b6d6d"/><file name="Cache.php" hash="0ca6ccc2fed56e2c602d76880d062053"/><file name="Debug.php" hash="6538ebc0cd0d61c124e5adc806e71aff"/><file name="Description.php" hash="e4f80883f8a2deab48af9625582edfb6"/><file name="Images.php" hash="78fb5e2054bbfaa2e76263b1aa9197cc"/><file name="Montant.php" hash="3a46b8d564f1c2f0ed3b62354ac8964f"/><file name="Payment.php" hash="4bebe8e6ab0f980c1ada872b46e86503"/><file name="Position.php" hash="f1d6f89f5db5bfeedc506c539e76e3a8"/><file name="Price.php" hash="71707a69106cdd4990767351ab78fc04"/><file name="Shipping.php" hash="3b38e6a923d98f2739b70c9960958dd6"/><file name="Status.php" hash="d32004ad97adac6de361703a403a6a97"/><file name="Userid.php" hash="3d028bc3bfcaf7541b57676c014c94db"/></dir></dir></dir></dir><dir name="controllers"><file name="CacheController.php" hash="512cc26abd39d556104d5e69c0ac8a0d"/><file name="CatalogController.php" hash="b1b170b6dcb9dc3f95dc46dec24a37a7"/><file name="CronController.php" hash="5cc9e5e5eca471d644ef7dee991ce6b9"/><file name="LogController.php" hash="5eff0d0a2c5621456e580e214d05c745"/><dir name="Sales"><file name="OrderController.php" hash="6c8ef505a493d60ce10711a8ea68d8a6"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d886bd576ed5349e2a27fcd2ec7dfd24"/><file name="config.xml" hash="1f9aef04a519b8297e746119169910c6"/><file name="system.xml" hash="1bdc7aa1db0c2db75a994b8f7a631e0f"/></dir><dir name="lib"><file name="BeezupMageOrders.php" hash="84701dee5023438a9c06b8abc5f6f2c1"/><file name="BeezupOMDataHandler.php" hash="cf738987179f3125fc0f4626fd70f1a0"/><file name="BeezupOMOrderService.php" hash="54c774ed85609226057ba2f0a859e474"/><file name="BeezupOMOrderServiceInterface.php" hash="9b18485ae224c32f46ae5a2ec5966e5b"/><file name="BeezupOMRepositoryInterface.php" hash="c2a8267c01c3e5def25ed41f715fa4b4"/><file name="BeezupOMRequestData.php" hash="162196502ecc6078ac6b7dec6f068c80"/><file name="BeezupOMResponseData.php" hash="955ce5316129e837190f2ccf9962d74f"/><file name="BeezupOMServiceClientProxy.php" hash="82821826016c467657d56b568a42bd35"/><file name="BeezupRepository.php" hash="b4ab353e99603e71faf37fc83d75dbe1"/><dir name="Common"><file name="BeezupOMCredential.php" hash="7f45272d16860058af07005dda39672e"/><file name="BeezupOMErrorSummary.php" hash="418db7b85beb030b2d28aee6c8b35bf1"/><file name="BeezupOMExpectedOrderChangeMetaInfo.php" hash="be802f69a3474d6cc6a5899711c7018c"/><file name="BeezupOMInfoSummaries.php" hash="cdece780cf38e3f09ce2d5550b93a567"/><file name="BeezupOMInfoSummary.php" hash="3b0d49f22882e239c87060aa58beb643"/><file name="BeezupOMLink.php" hash="9fa99dce0b51e235e101259b2f0304f8"/><file name="BeezupOMOrderIdentifier.php" hash="334f410bf0794cb2ce02b4b1e6d3e0f4"/><file name="BeezupOMProcessingStatus.php" hash="b70c4c23a75360b5bee4d9ddec9e7915"/><file name="BeezupOMRequest.php" hash="2497b1ed30c12d179a5629479aee418d"/><file name="BeezupOMResponse.php" hash="690688115873ac9a3172bf67a0d62b50"/><file name="BeezupOMResult.php" hash="5cb890ce4ad4205114dd94cd1f28222d"/><file name="BeezupOMSuccessSummary.php" hash="791c6c186ed15ec1b872905b820cd03c"/><file name="BeezupOMSummary.php" hash="6cc3712480eff9f19b80b0ab887155f0"/><file name="BeezupOMWarningSummary.php" hash="03cfd6a98901b6b460b974b8e938a659"/></dir><dir name="Harvest"><file name="BeezupOMHarvestAbstractReporting.php" hash="3d499a69ea7b646eaeef5b80f0a919f3"/><file name="BeezupOMHarvestClientReporting.php" hash="1e40eca349352912e408718f3b218777"/><file name="BeezupOMHarvestOrderReporting.php" hash="778ba93a7673f35b2072003e3510ba6b"/></dir><file name="KLogger.php" hash="fe1d31bbfdf4d59a858ffd43453536c2"/><dir name="LOV"><file name="BeezupOMLOVRequest.php" hash="165c873b3fea4201a3b35596d24ffe36"/><file name="BeezupOMLOVResponse.php" hash="586749fb17b16d5ff9f07909e516b3c7"/><file name="BeezupOMLOVResult.php" hash="c0e3cc917a1d625ac6094917481a7b52"/><file name="BeezupOMLOVValue.php" hash="0dd13ae88e99c2537df8804f3af248b9"/></dir><dir name="Order"><file name="BeezupOMOrderItem.php" hash="a770b90ae4fcb6535563be6ff59f7528"/><file name="BeezupOMOrderRequest.php" hash="9afa0f18fc0aef344c3f71d054db23a0"/><file name="BeezupOMOrderResponse.php" hash="e8793a8754ec75a92ca6266357462307"/><file name="BeezupOMOrderResult.php" hash="87ae70f6b82e49e45bc12a8155dec629"/></dir><dir name="OrderChange"><file name="BeezupOMOrderChangeMetaInfo.php" hash="abdbdfd6c3bf291fd38f9b3ddc419405"/><file name="BeezupOMOrderChangeRequest.php" hash="f43b9c0a052fe5346a1b309c6d96ae9c"/><file name="BeezupOMOrderChangeResponse.php" hash="bbb4e49e5ddb90991e763daa439a5642"/><file name="BeezupOMOrderChangeResult.php" hash="e7314addf6c2e51196577055d583f350"/></dir><dir name="OrderHistory"><file name="BeezupOMOrderChangeReporting.php" hash="fc7a7d7ee8bc53f8c5b7ed19793a911a"/><file name="BeezupOMOrderHarvestReporting.php" hash="e4cb500ef347d8e8543e0bf278d3d77c"/><file name="BeezupOMOrderHistoryRequest.php" hash="2e39c26d8d9dd4d5a92a2cde06c41353"/><file name="BeezupOMOrderHistoryResponse.php" hash="dc6a0c6dc89bf1f376d1ecfebd052a4b"/><file name="BeezupOMOrderHistoryResult.php" hash="d85d9b4ecf6c0456b5c8453cc3b9cfdd"/></dir><dir name="OrderList"><file name="BeezupOMOrderHeader.php" hash="af366bc39855f1315678f01b53859c1c"/><file name="BeezupOMOrderListRequest.php" hash="817c20c7c82fd5f05e0efb19ee19ec4b"/><file name="BeezupOMOrderListResponse.php" hash="b1b0ed33ba495f6e2c2f3a39ade2a5cd"/><file name="BeezupOMOrderListResult.php" hash="8befe82305a6c6fe3cacf113b3722585"/><file name="BeezupOMPaginationResult.php" hash="1e1ef534ddef8ac43d98839b4ed7f941"/></dir><dir name="SetOrderId"><file name="BeezupOMSetOrderIdRequest.php" hash="40b4a05023396115f582c2e907834e3b"/><file name="BeezupOMSetOrderIdResponse.php" hash="c4cb1f9013ae32dfdff8ca80e4725282"/><file name="BeezupOMSetOrderIdResult.php" hash="8b35abb55c52f6acdfd55bf20b370bf0"/><file name="BeezupOMSetOrderIdValues.php" hash="978b41465512c15bfe160463ca23d24f"/></dir><dir name="Stores"><file name="BeezupOMStore.php" hash="0882efcae2eff339d6cdcceee83135a7"/><file name="BeezupOMStoresRequest.php" hash="a6b1391e306f2ed21fd5e2fcdbcbbec5"/><file name="BeezupOMStoresResponse.php" hash="21535a8957506ef7da343a0526b57b02"/><file name="BeezupOMStoresResult.php" hash="d4ceed947e9e8086638497e75bbd20e8"/></dir><file name="bootstrap.php" hash="9e0e69bc9e9a932c7c80f8480c025bd2"/></dir><dir name="sql"><dir name="beezup_setup"><file name="mysql4-install-4.0.0.php" hash="e035e76fe92b063d6cecc9fa2872cfab"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="BeezUp.xml" hash="93df32f86c55b57363b9abc62cf68474"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="BeezUp.csv" hash="16016048b107a6bae72a96fb4adb4c0d"/></dir><dir name="en_US"><file name="BeezUp.csv" hash="27b63e33bbdf8b1edfd0ec63c55b18cb"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="beezup_salestab.xml" hash="784925d72538a1eeb0ca695417147a7a"/></dir><dir name="template"><dir name="beezup"><file name="custom.phtml" hash="d56dcd5673f81cb8e7e2ca90bb10d4ee"/></dir></dir></dir></dir></dir></target></contents>
51
  <compatible/>
52
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
53
  </package>