Yfs_Ecomm - Version 1.0.5

Version Notes

Bug fixes in sync process,inventory update and order status update

Download this release

Release Info

Developer Jayneel
Extension Yfs_Ecomm
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

app/code/local/Yfs/Ecomm/Model/Sales/Api/V2.php CHANGED
@@ -17,7 +17,8 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
17
  }
18
  $result = $readConnection->fetchAll($query);
19
  return $result[0]["COUNT('increment_id')"];
20
- }
 
21
  public function getOrderList($fromDate = null,$toDate = null,$page = null, $limit = null, $resync = 1, $filters = null)
22
  {
23
  if(!$limit)
@@ -76,7 +77,7 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
76
  $result = array();
77
 
78
  foreach ($collection as $order) {
79
- $row = array();
80
  $row = $this->_getAttributes($order, 'order');
81
  $row['shipping_address'] = $this->_getAttributes($order->getShippingAddress(), 'order_address');
82
  $row['billing_address'] = $this->_getAttributes($order->getBillingAddress(), 'order_address');
@@ -99,6 +100,28 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
99
  $options = json_encode($options1);
100
  $itemData['product_options'] = $options;
101
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  $row['items'][$key] = $itemData;
103
  if($resync == 0)
104
  {
@@ -137,7 +160,8 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
137
  }
138
 
139
  return $result;
140
- }
 
141
  public function getTaxConfig()
142
  {
143
  $tableName = Mage::getSingleton('core/resource')->getTableName('core_config_data');
@@ -161,7 +185,8 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
161
  else
162
  $tax_config['shipping'] = 'outward';
163
  return $tax_config['shipping'];
164
- }
 
165
  public function updateOrderStatus($orderId,$status,$sku1 = Null,$shipping_method_name = Null,$tracking_number = Null)
166
  {
167
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
@@ -182,35 +207,8 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
182
  $qtys[$item->getId()] = $sku[$Itemsku];
183
  }
184
  }
185
-
186
- if($status == confirmed)
187
- {
188
- if($qtys)
189
- {
190
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($qtys);
191
-
192
- $amount = $invoice->getGrandTotal();
193
- $invoice->register()->pay();
194
- $invoice->getOrder()->setIsInProcess(true);
195
-
196
- $history = $invoice->getOrder()->addStatusHistoryComment(
197
- 'Partial amount of $' . $amount . ' captured automatically.', false
198
- );
199
-
200
- $history->setIsCustomerNotified(true);
201
-
202
- $order->save();
203
-
204
- Mage::getModel('core/resource_transaction')
205
- ->addObject($invoice)
206
- ->addObject($invoice->getOrder())
207
- ->save();
208
- $invoice->save();
209
- $invoice->sendEmail(true, '');
210
- $bool = true;
211
- }
212
- }
213
- else if($status == shipped)
214
  {
215
  if($qtys)
216
  {
@@ -235,19 +233,44 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
235
  ->addObject($shipment)
236
  ->addObject($shipment->getOrder())
237
  ->save();
 
 
 
 
 
 
 
 
 
238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  $bool = true;
240
  }
 
241
  }
242
  else if($status == canceled)
243
  {
244
  $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
245
  $bool = true;
246
  }
247
- else if($status == complete)
248
- {
249
- $bool = true;
250
- }
251
  if($bool)
252
  {
253
  return true;
@@ -257,6 +280,7 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
257
  return false;
258
  }
259
  }
 
260
  public function getOrderStatus($orderId)
261
  {
262
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
@@ -270,6 +294,7 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
270
  return false;
271
  }
272
  }
 
273
  protected function _getAttributes($object, $type, array $attributes = null)
274
  {
275
  $result = array();
@@ -296,6 +321,7 @@ class Yfs_Ecomm_Model_Sales_Api_V2 extends Mage_Sales_Model_Order_Api_V2
296
 
297
  return $result;
298
  }
 
299
  protected function _isAllowedAttribute($attributeCode, $type, array $attributes = null)
300
  {
301
  if (!empty($attributes)
17
  }
18
  $result = $readConnection->fetchAll($query);
19
  return $result[0]["COUNT('increment_id')"];
20
+ }
21
+
22
  public function getOrderList($fromDate = null,$toDate = null,$page = null, $limit = null, $resync = 1, $filters = null)
23
  {
24
  if(!$limit)
77
  $result = array();
78
 
79
  foreach ($collection as $order) {
80
+ $row = array();
81
  $row = $this->_getAttributes($order, 'order');
82
  $row['shipping_address'] = $this->_getAttributes($order->getShippingAddress(), 'order_address');
83
  $row['billing_address'] = $this->_getAttributes($order->getBillingAddress(), 'order_address');
100
  $options = json_encode($options1);
101
  $itemData['product_options'] = $options;
102
  }
103
+ if($itemData['product_type'] == 'configurable')
104
+ {
105
+ $tempArray = $itemData;
106
+ }
107
+ if($itemData['product_type'] == 'simple' && $itemData['sku'] == $tempArray['sku'])
108
+ {
109
+ $itemData['qty_canceled'] = ($itemData['qty_canceled'] <= 0) ? $tempArray['qty_canceled'] : $itemData['qty_canceled'];
110
+ $itemData['qty_invoiced'] = ($itemData['qty_invoiced'] <= 0) ? $tempArray['qty_invoiced'] : $itemData['qty_invoiced'];
111
+ $itemData['qty_refunded'] = ($itemData['qty_refunded'] <= 0) ? $tempArray['qty_refunded'] : $itemData['qty_refunded'];
112
+ $itemData['qty_shipped'] = ($itemData['qty_shipped'] <= 0) ? $tempArray['qty_shipped'] : $itemData['qty_shipped'];
113
+ $itemData['price'] = ($itemData['price'] <= 0) ? $tempArray['price'] : $itemData['price'];
114
+ $itemData['base_price'] = ($itemData['base_price'] <= 0) ? $tempArray['base_price'] : $itemData['base_price'];
115
+ $itemData['original_price'] = ($itemData['original_price'] <= 0) ? $tempArray['original_price'] : $itemData['original_price'];
116
+ $itemData['base_original_price'] = ($itemData['base_original_price'] <= 0) ? $tempArray['base_original_price'] : $itemData['base_original_price'];
117
+ $itemData['tax_percent'] = ($itemData['tax_percent'] <= 0) ? $tempArray['tax_percent'] : $itemData['tax_percent'];
118
+ $itemData['tax_amount'] = ($itemData['tax_amount'] <= 0) ? $tempArray['tax_amount'] : $itemData['tax_amount'];
119
+ $itemData['discount_percent'] = ($itemData['discount_percent'] <= 0) ? $tempArray['discount_percent'] : $itemData['discount_percent'];
120
+ $itemData['discount_amount'] = ($itemData['discount_amount'] <= 0) ? $tempArray['discount_amount'] : $itemData['discount_amount'];
121
+ $itemData['row_total'] = ($itemData['row_total'] <= 0) ? $tempArray['row_total'] : $itemData['row_total'];
122
+ $itemData['base_row_total'] = ($itemData['base_row_total'] <= 0) ? $tempArray['base_row_total'] : $itemData['base_row_total'];
123
+ $tempArray = array();
124
+ }
125
  $row['items'][$key] = $itemData;
126
  if($resync == 0)
127
  {
160
  }
161
 
162
  return $result;
163
+ }
164
+
165
  public function getTaxConfig()
166
  {
167
  $tableName = Mage::getSingleton('core/resource')->getTableName('core_config_data');
185
  else
186
  $tax_config['shipping'] = 'outward';
187
  return $tax_config['shipping'];
188
+ }
189
+
190
  public function updateOrderStatus($orderId,$status,$sku1 = Null,$shipping_method_name = Null,$tracking_number = Null)
191
  {
192
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
207
  $qtys[$item->getId()] = $sku[$Itemsku];
208
  }
209
  }
210
+
211
+ if($status == shipped)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  {
213
  if($qtys)
214
  {
233
  ->addObject($shipment)
234
  ->addObject($shipment->getOrder())
235
  ->save();
236
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
237
+ $bool = true;
238
+ }
239
+ }
240
+ else if($status == complete)
241
+ {
242
+ if($qtys)
243
+ {
244
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($qtys);
245
 
246
+ $amount = $invoice->getGrandTotal();
247
+ $invoice->register()->pay();
248
+ $invoice->getOrder()->setIsInProcess(true);
249
+
250
+ $history = $invoice->getOrder()->addStatusHistoryComment(
251
+ 'Partial amount of $' . $amount . ' captured automatically.', false
252
+ );
253
+
254
+ $history->setIsCustomerNotified(true);
255
+
256
+ $order->save();
257
+
258
+ Mage::getModel('core/resource_transaction')
259
+ ->addObject($invoice)
260
+ ->addObject($invoice->getOrder())
261
+ ->save();
262
+ $invoice->save();
263
+ $invoice->sendEmail(true, '');
264
+ $order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, true)->save();
265
  $bool = true;
266
  }
267
+ $bool = true;
268
  }
269
  else if($status == canceled)
270
  {
271
  $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
272
  $bool = true;
273
  }
 
 
 
 
274
  if($bool)
275
  {
276
  return true;
280
  return false;
281
  }
282
  }
283
+
284
  public function getOrderStatus($orderId)
285
  {
286
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
294
  return false;
295
  }
296
  }
297
+
298
  protected function _getAttributes($object, $type, array $attributes = null)
299
  {
300
  $result = array();
321
 
322
  return $result;
323
  }
324
+
325
  protected function _isAllowedAttribute($attributeCode, $type, array $attributes = null)
326
  {
327
  if (!empty($attributes)
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Yfs_Ecomm</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Orderhive-Integration Extension for Magento will provide smooth and reliable APIs (products, customers and sales orders) for sharing large amount of data between your store and Orderhive without affecting your store performance. It provides an interface to revoke permission from Orderhive in order to stop API calls.</description>
11
  <notes>Bug fixes in sync process,inventory update and order status update</notes>
12
  <authors><author><name>Jayneel</name><user>jayneel</user><email>jayneel@openxcell.com</email></author><author><name>Niyati</name><user>niyati7</user><email>niyati@openxcelltechnolabs.com</email></author></authors>
13
- <date>2014-11-11</date>
14
- <time>12:10:07</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Yfs_Ecomm.xml" hash="08fcae739eadbee91bad139fe1f684a6"/></dir></target><target name="magelocal"><dir name="Yfs"><dir name="Ecomm"><dir name="Helper"><file name="Data.php" hash="ed76f9874e036fedc5729f5afdbec816"/></dir><dir name="Model"><dir name="Catalog"><dir name="Api"><file name="V2.php" hash="6ddeaab144a1b59ff035b7a56c57e27d"/></dir></dir><dir name="Customer"><dir name="Api"><file name="V2.php" hash="454cab3b2928ccc671338d638b9e7d07"/></dir></dir><dir name="Sales"><dir name="Api"><file name="V2.php" hash="4c04f6b3bc48e0a9299a1f9c348fb28e"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bbc34dd5b03a63b1d029408a42307d53"/><file name="api.xml" hash="17686a001997f438f72442124bbb4ec9"/><file name="config.xml" hash="424f465679881b4cdd5375bf315d4f34"/><file name="system.xml" hash="748d8877c7bcffa6558bd70d157cfcef"/><file name="wsdl.xml" hash="e04abc607f8e58062c66eb613883a78f"/><file name="wsi.xml" hash="2f010dc0a5385dd561b6d5750d128e30"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Yfs_Ecomm</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
10
  <description>Orderhive-Integration Extension for Magento will provide smooth and reliable APIs (products, customers and sales orders) for sharing large amount of data between your store and Orderhive without affecting your store performance. It provides an interface to revoke permission from Orderhive in order to stop API calls.</description>
11
  <notes>Bug fixes in sync process,inventory update and order status update</notes>
12
  <authors><author><name>Jayneel</name><user>jayneel</user><email>jayneel@openxcell.com</email></author><author><name>Niyati</name><user>niyati7</user><email>niyati@openxcelltechnolabs.com</email></author></authors>
13
+ <date>2015-04-17</date>
14
+ <time>10:29:19</time>
15
+ <contents><target name="magelocal"><dir name="Yfs"><dir name="Ecomm"><dir name="Helper"><file name="Data.php" hash="ed76f9874e036fedc5729f5afdbec816"/></dir><dir name="Model"><dir name="Catalog"><dir name="Api"><file name="V2.php" hash="6ddeaab144a1b59ff035b7a56c57e27d"/></dir></dir><dir name="Customer"><dir name="Api"><file name="V2.php" hash="454cab3b2928ccc671338d638b9e7d07"/></dir></dir><dir name="Sales"><dir name="Api"><file name="V2.php" hash="75884f191c1baca792f96768919e781a"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bbc34dd5b03a63b1d029408a42307d53"/><file name="api.xml" hash="17686a001997f438f72442124bbb4ec9"/><file name="config.xml" hash="424f465679881b4cdd5375bf315d4f34"/><file name="system.xml" hash="748d8877c7bcffa6558bd70d157cfcef"/><file name="wsdl.xml" hash="e04abc607f8e58062c66eb613883a78f"/><file name="wsi.xml" hash="2f010dc0a5385dd561b6d5750d128e30"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Yfs_Ecomm.xml" hash="08fcae739eadbee91bad139fe1f684a6"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>