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.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
app/code/local/Yfs/Ecomm/Model/Catalog/Api.php
CHANGED
@@ -1,26 +1,27 @@
|
|
1 |
<?php
|
|
|
2 |
class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
{
|
4 |
function _getOptionLabel($arg_attribute,$optionId)
|
5 |
{
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
}
|
25 |
function _getAttributeType($attribute_code)
|
26 |
{
|
@@ -29,12 +30,17 @@ class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
|
29 |
}
|
30 |
public function getProductsCount()
|
31 |
{
|
32 |
-
|
|
|
|
|
|
|
33 |
}
|
34 |
public function getProducts()
|
35 |
{
|
36 |
-
$collection = Mage::getResourceModel('catalog/product_collection')->
|
37 |
-
|
|
|
|
|
38 |
}
|
39 |
public function getProductInfo($id, $attributes = null, $size = null, $filters = null)
|
40 |
{
|
@@ -55,7 +61,7 @@ class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
|
55 |
$prodInfo['sku'] = $pro->getSku();
|
56 |
$prodInfo['description'] = $product->getDescription();
|
57 |
$prodInfo['price'] = $product->getPrice();
|
58 |
-
foreach($attributes as $attribute)
|
59 |
{
|
60 |
if($this->_getAttributeType($attribute) == 'select')
|
61 |
{
|
@@ -74,12 +80,8 @@ class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
|
74 |
}
|
75 |
else
|
76 |
$prodInfo[$size] = $pro->getData($size);
|
77 |
-
}
|
78 |
-
|
79 |
-
foreach($media as $image)
|
80 |
-
{
|
81 |
-
$prodInfo['media'][]= $image->getData();
|
82 |
-
}
|
83 |
return $prodInfo;
|
84 |
}
|
85 |
|
@@ -105,18 +107,23 @@ class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
|
105 |
{
|
106 |
return false;
|
107 |
}
|
108 |
-
|
109 |
}
|
110 |
else
|
111 |
{
|
112 |
return false;
|
113 |
}
|
114 |
-
|
115 |
}
|
116 |
|
117 |
public function isExtensionEnabled()
|
118 |
{
|
119 |
return Mage::getStoreConfig('ecomm/ecomm/allow');
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
4 |
{
|
5 |
function _getOptionLabel($arg_attribute,$optionId)
|
6 |
{
|
7 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
8 |
+
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
9 |
|
10 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
11 |
+
$attribute = $attribute_model->load($attribute_code);
|
12 |
|
13 |
+
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
14 |
+
$options = $attribute_options_model->getAllOptions(false);
|
15 |
|
16 |
+
foreach($options as $option)
|
17 |
+
{
|
18 |
+
if ($option['value'] == $optionId)
|
19 |
+
{
|
20 |
+
$optionId = $option['label'];
|
21 |
+
break;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
return $optionId;
|
25 |
}
|
26 |
function _getAttributeType($attribute_code)
|
27 |
{
|
30 |
}
|
31 |
public function getProductsCount()
|
32 |
{
|
33 |
+
$collection = Mage::getModel('catalog/product')->getCollection()->
|
34 |
+
addAttributeToFilter('type_id', array('eq' => 'simple'))->
|
35 |
+
addAttributeToFilter('status',array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))->getSize();
|
36 |
+
return $collection;
|
37 |
}
|
38 |
public function getProducts()
|
39 |
{
|
40 |
+
$collection = Mage::getResourceModel('catalog/product_collection')->
|
41 |
+
addAttributeToFilter('type_id', array('eq' => 'simple'))->
|
42 |
+
addAttributeToFilter('status',array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))->getAllIds();
|
43 |
+
return $collection;
|
44 |
}
|
45 |
public function getProductInfo($id, $attributes = null, $size = null, $filters = null)
|
46 |
{
|
61 |
$prodInfo['sku'] = $pro->getSku();
|
62 |
$prodInfo['description'] = $product->getDescription();
|
63 |
$prodInfo['price'] = $product->getPrice();
|
64 |
+
/*foreach($attributes as $attribute)
|
65 |
{
|
66 |
if($this->_getAttributeType($attribute) == 'select')
|
67 |
{
|
80 |
}
|
81 |
else
|
82 |
$prodInfo[$size] = $pro->getData($size);
|
83 |
+
}*/
|
84 |
+
|
|
|
|
|
|
|
|
|
85 |
return $prodInfo;
|
86 |
}
|
87 |
|
107 |
{
|
108 |
return false;
|
109 |
}
|
110 |
+
}
|
111 |
}
|
112 |
else
|
113 |
{
|
114 |
return false;
|
115 |
}
|
|
|
116 |
}
|
117 |
|
118 |
public function isExtensionEnabled()
|
119 |
{
|
120 |
return Mage::getStoreConfig('ecomm/ecomm/allow');
|
121 |
}
|
122 |
+
|
123 |
+
public function Timezone()
|
124 |
+
{
|
125 |
+
$timezone = Mage::app()->getStore()->getConfig('general/locale/timezone');
|
126 |
+
return $timezone;
|
127 |
+
}
|
128 |
}
|
129 |
?>
|
app/code/local/Yfs/Ecomm/Model/Sales/Api.php
CHANGED
@@ -1,28 +1,36 @@
|
|
1 |
<?php
|
2 |
class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
{
|
4 |
-
public function getOrderIncrementIdCount()
|
5 |
{
|
6 |
-
|
|
|
|
|
7 |
$readConnection = $resource->getConnection('core_read');
|
8 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
$result = $readConnection->fetchAll($query);
|
10 |
return $result[0]["COUNT('increment_id')"];
|
11 |
}
|
12 |
public function getTaxConfig()
|
13 |
{
|
|
|
|
|
14 |
$resource = Mage::getSingleton('core/resource');
|
15 |
$readConnection = $resource->getConnection('core_read');
|
16 |
-
$query1 = "SELECT value
|
17 |
-
FROM `core_config_data`
|
18 |
-
WHERE `path` LIKE 'tax/calculation/price_includes_tax'";
|
19 |
$result1 = $readConnection->fetchAll($query1);
|
20 |
|
21 |
$tax_config = array();
|
22 |
|
23 |
-
$query2 = "SELECT value
|
24 |
-
FROM `core_config_data`
|
25 |
-
WHERE `path` LIKE 'tax/calculation/shipping_includes_tax'";
|
26 |
$result2 = $readConnection->fetchAll($query2);
|
27 |
|
28 |
if($result1[0]['value'] == 1)
|
@@ -36,22 +44,35 @@ class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
|
36 |
return $tax_config;
|
37 |
|
38 |
}
|
39 |
-
public function getOrderIncrementIds($lastIncrementId)
|
40 |
{
|
|
|
|
|
41 |
$resource = Mage::getSingleton('core/resource');
|
42 |
$readConnection = $resource->getConnection('core_read');
|
43 |
$lastRecordId = 0;
|
44 |
if($lastIncrementId)
|
45 |
{
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
-
|
51 |
-
if($lastRecordId)
|
52 |
-
$query = "SELECT increment_id FROM sales_flat_order WHERE entity_id > ".$lastRecordId." LIMIT 1000" ;
|
53 |
else
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
$result = $readConnection->fetchAll($query);
|
56 |
$increment_ids = array();
|
57 |
foreach($result as $order)
|
@@ -182,15 +203,16 @@ class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
|
182 |
}
|
183 |
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
switch ($status)
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
|
193 |
-
|
|
|
194 |
|
195 |
$orders=Mage::getModel('sales/mysql4_order_collection');
|
196 |
//Optional filters you might want to use - more available operations in method _getConditionSql in Varien_Data_Collection_Db.
|
@@ -209,33 +231,33 @@ class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
|
209 |
$pOrder = array();
|
210 |
$pendingItems = array();
|
211 |
$itemIndex = 0;
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
$pOrder['increment_id'] = $orderData['increment_id'];
|
240 |
$pOrder['entity_id'] = $orderData['entity_id'];
|
241 |
$pOrder['status'] = $tempOrder->getStatus();
|
@@ -267,120 +289,119 @@ class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
|
267 |
}
|
268 |
return $pendingOrders;
|
269 |
//return $orderIndex;
|
270 |
-
}
|
|
|
271 |
{
|
272 |
// return $orderIndex;
|
273 |
return $e->getMessage();
|
274 |
}
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
}
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
{
|
324 |
-
if($qtys)
|
325 |
-
{
|
326 |
-
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($qtys);
|
327 |
-
|
328 |
-
$arrTracking = array(
|
329 |
-
'carrier_code' => $order->getShippingCarrier()->getCarrierCode(),
|
330 |
-
'title' => isset($shipping_method_name) ? $shipping_method_name : $order->getShippingCarrier()->getConfigData('title'),
|
331 |
-
'number' => $tracking_number,
|
332 |
-
);
|
333 |
-
|
334 |
-
$track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
|
335 |
-
$shipment->addTrack($track);
|
336 |
-
|
337 |
-
$shipment->register();
|
338 |
-
|
339 |
-
$shipment->sendEmail(true)->setEmailSent(true)->save();
|
340 |
-
|
341 |
-
$order->setIsInProcess(true);
|
342 |
-
|
343 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
344 |
-
->addObject($shipment)
|
345 |
-
->addObject($shipment->getOrder())
|
346 |
-
->save();
|
347 |
-
$bool = true;
|
348 |
-
}
|
349 |
-
}
|
350 |
-
else if($status == Cancel || $status == cancel)
|
351 |
-
{
|
352 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
|
353 |
-
$bool = true;
|
354 |
-
}
|
355 |
-
else if($status == Complete || $status == complete)
|
356 |
-
{
|
357 |
-
$bool = true;
|
358 |
-
}
|
359 |
-
if($bool)
|
360 |
-
{
|
361 |
-
return true;
|
362 |
-
}
|
363 |
-
else
|
364 |
-
{
|
365 |
-
return false;
|
366 |
-
}
|
367 |
-
}
|
368 |
|
|
|
369 |
|
370 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
{
|
372 |
-
|
373 |
-
if($order)
|
374 |
-
{
|
375 |
-
$status = $order->getStatusLabel();
|
376 |
-
return $status;
|
377 |
-
}
|
378 |
-
else
|
379 |
-
{
|
380 |
-
return false;
|
381 |
-
}
|
382 |
-
|
383 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
|
385 |
}
|
386 |
?>
|
1 |
<?php
|
2 |
class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
{
|
4 |
+
public function getOrderIncrementIdCount($date_from = null,$date_to = null)
|
5 |
{
|
6 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
7 |
+
|
8 |
+
$resource = Mage::getSingleton('core/resource');
|
9 |
$readConnection = $resource->getConnection('core_read');
|
10 |
+
if($date_from)
|
11 |
+
{
|
12 |
+
$query = "SELECT COUNT('increment_id') FROM ".$tableName." where created_at BETWEEN '" . $date_from . "' AND '" . $date_to . "'";
|
13 |
+
}
|
14 |
+
else
|
15 |
+
{
|
16 |
+
$query = "SELECT COUNT('increment_id') FROM ".$tableName;
|
17 |
+
}
|
18 |
+
|
19 |
$result = $readConnection->fetchAll($query);
|
20 |
return $result[0]["COUNT('increment_id')"];
|
21 |
}
|
22 |
public function getTaxConfig()
|
23 |
{
|
24 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('core_config_data');
|
25 |
+
|
26 |
$resource = Mage::getSingleton('core/resource');
|
27 |
$readConnection = $resource->getConnection('core_read');
|
28 |
+
$query1 = "SELECT value FROM ".$tableName." WHERE `path` LIKE 'tax/calculation/price_includes_tax'";
|
|
|
|
|
29 |
$result1 = $readConnection->fetchAll($query1);
|
30 |
|
31 |
$tax_config = array();
|
32 |
|
33 |
+
$query2 = "SELECT value FROM ".$tableName." WHERE `path` LIKE 'tax/calculation/shipping_includes_tax'";
|
|
|
|
|
34 |
$result2 = $readConnection->fetchAll($query2);
|
35 |
|
36 |
if($result1[0]['value'] == 1)
|
44 |
return $tax_config;
|
45 |
|
46 |
}
|
47 |
+
public function getOrderIncrementIds($lastIncrementId,$date_from = null,$date_to = null)
|
48 |
{
|
49 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
50 |
+
|
51 |
$resource = Mage::getSingleton('core/resource');
|
52 |
$readConnection = $resource->getConnection('core_read');
|
53 |
$lastRecordId = 0;
|
54 |
if($lastIncrementId)
|
55 |
{
|
56 |
+
$getLastRecordQuery = "SELECT entity_id FROM ".$tableName." WHERE increment_id = ".$lastIncrementId;
|
57 |
+
$getLastRecord = $readConnection->fetchAll($getLastRecordQuery);
|
58 |
+
$lastRecordId = $getLastRecord[0]['entity_id'];
|
59 |
+
}
|
60 |
+
|
61 |
+
if($date_from)
|
62 |
+
{
|
63 |
+
if($lastRecordId)
|
64 |
+
$query = "SELECT increment_id FROM ".$tableName." WHERE entity_id > ".$lastRecordId." AND created_at BETWEEN '" . $date_from . "' AND '" . $date_to . "' LIMIT 1000" ;
|
65 |
+
else
|
66 |
+
$query = "SELECT increment_id FROM ".$tableName." where created_at BETWEEN '" . $date_from . "' AND '" . $date_to . "' LIMIT 1000" ;
|
67 |
}
|
|
|
|
|
|
|
68 |
else
|
69 |
+
{
|
70 |
+
if($lastRecordId)
|
71 |
+
$query = "SELECT increment_id FROM ".$tableName." WHERE entity_id > ".$lastRecordId." LIMIT 1000" ;
|
72 |
+
else
|
73 |
+
$query = "SELECT increment_id FROM ".$tableName." LIMIT 1000" ;
|
74 |
+
}
|
75 |
+
|
76 |
$result = $readConnection->fetchAll($query);
|
77 |
$increment_ids = array();
|
78 |
foreach($result as $order)
|
203 |
}
|
204 |
|
205 |
|
206 |
+
public function getOrderByStatus($status,$fromDate,$toDate)
|
207 |
+
{
|
208 |
+
switch ($status)
|
209 |
+
{
|
210 |
+
case 'pending' : break;
|
211 |
+
//default: return "Invalid Order status";
|
212 |
+
}
|
213 |
|
214 |
+
try
|
215 |
+
{
|
216 |
|
217 |
$orders=Mage::getModel('sales/mysql4_order_collection');
|
218 |
//Optional filters you might want to use - more available operations in method _getConditionSql in Varien_Data_Collection_Db.
|
231 |
$pOrder = array();
|
232 |
$pendingItems = array();
|
233 |
$itemIndex = 0;
|
234 |
+
foreach ($tempOrder->getItemsCollection() as $item)
|
235 |
+
{
|
236 |
+
$pItem = array();
|
237 |
+
$itemData = $item->getData();
|
238 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());
|
239 |
+
$optionId = $product->getData('size');
|
240 |
+
if($itemData['parent_item_id'])
|
241 |
+
{
|
242 |
+
continue;
|
243 |
+
}
|
244 |
+
$pItem['item_id'] = $itemData['item_id'];
|
245 |
+
$pItem['name'] = $itemData['name'];
|
246 |
+
$pItem['qty_ordered'] = $itemData['qty_ordered'];
|
247 |
+
$pItem['size'] = $this->_getOptionLabel('size',$optionId);
|
248 |
+
$pItem['product_type'] = $item->getProductType();
|
249 |
+
$pItem['product_id'] = $itemData['product_id'];
|
250 |
+
$pItem['product_options'] = $itemData['product_options'];
|
251 |
+
$pItem['sku'] = $itemData['sku'];
|
252 |
+
$pItem['discount_amount'] = $itemData['discount_amount'];
|
253 |
+
$pItem['base_price'] = $itemData['base_price'];
|
254 |
+
$pItem['base_price_incl_tax'] = $itemData['base_price_incl_tax'];
|
255 |
+
$pItem['row_total_incl_tax'] = $itemData['row_total_incl_tax'];
|
256 |
+
$pItem['tax_percent'] = $itemData['tax_percent'];
|
257 |
+
$pItem['tax_amount' ] = $itemData['tax_amount'];
|
258 |
+
$itemIndex++;
|
259 |
+
$pendingItems['item'.$itemIndex] = $pItem;
|
260 |
+
}
|
261 |
$pOrder['increment_id'] = $orderData['increment_id'];
|
262 |
$pOrder['entity_id'] = $orderData['entity_id'];
|
263 |
$pOrder['status'] = $tempOrder->getStatus();
|
289 |
}
|
290 |
return $pendingOrders;
|
291 |
//return $orderIndex;
|
292 |
+
}
|
293 |
+
catch(Exception $e)
|
294 |
{
|
295 |
// return $orderIndex;
|
296 |
return $e->getMessage();
|
297 |
}
|
298 |
|
299 |
+
}
|
300 |
+
|
301 |
+
public function updateOrderStatus($orderId,$status,$sku,$shipping_method_name,$tracking_number)
|
302 |
+
{
|
303 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
304 |
+
$items = $order->getItemsCollection();
|
305 |
+
$qtys = array();
|
306 |
+
$bool = false;
|
307 |
+
|
308 |
+
foreach($items as $item)
|
309 |
+
{
|
310 |
+
$Itemsku = $item->getSku();
|
311 |
+
if(array_key_exists($Itemsku,$sku))
|
312 |
+
{
|
313 |
+
$qtys[$item->getId()] = $sku[$Itemsku];
|
314 |
+
}
|
315 |
}
|
316 |
|
317 |
+
if($status == confirmed)
|
318 |
+
{
|
319 |
+
if($qtys)
|
320 |
+
{
|
321 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($qtys);
|
322 |
+
|
323 |
+
$amount = $invoice->getGrandTotal();
|
324 |
+
$invoice->register()->pay();
|
325 |
+
$invoice->getOrder()->setIsInProcess(true);
|
326 |
+
|
327 |
+
$history = $invoice->getOrder()->addStatusHistoryComment(
|
328 |
+
'Partial amount of $' . $amount . ' captured automatically.', false
|
329 |
+
);
|
330 |
+
|
331 |
+
$history->setIsCustomerNotified(true);
|
332 |
+
|
333 |
+
$order->save();
|
334 |
+
|
335 |
+
Mage::getModel('core/resource_transaction')
|
336 |
+
->addObject($invoice)
|
337 |
+
->addObject($invoice->getOrder())
|
338 |
+
->save();
|
339 |
+
$invoice->save();
|
340 |
+
$invoice->sendEmail(true, '');
|
341 |
+
$bool = true;
|
342 |
+
}
|
343 |
+
}
|
344 |
+
else if($status == shipped)
|
345 |
+
{
|
346 |
+
if($qtys)
|
347 |
+
{
|
348 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($qtys);
|
349 |
+
|
350 |
+
$arrTracking = array(
|
351 |
+
'carrier_code' => $order->getShippingCarrier()->getCarrierCode(),
|
352 |
+
'title' => isset($shipping_method_name) ? $shipping_method_name : $order->getShippingCarrier()->getConfigData('title'),
|
353 |
+
'number' => $tracking_number,
|
354 |
+
);
|
355 |
+
|
356 |
+
$track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
|
357 |
+
$shipment->addTrack($track);
|
358 |
+
|
359 |
+
$shipment->register();
|
360 |
+
|
361 |
+
$shipment->sendEmail(true)->setEmailSent(true)->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
|
363 |
+
$order->setIsInProcess(true);
|
364 |
|
365 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
366 |
+
->addObject($shipment)
|
367 |
+
->addObject($shipment->getOrder())
|
368 |
+
->save();
|
369 |
+
|
370 |
+
$bool = true;
|
371 |
+
}
|
372 |
+
}
|
373 |
+
else if($status == canceled)
|
374 |
+
{
|
375 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
|
376 |
+
$bool = true;
|
377 |
+
}
|
378 |
+
else if($status == complete)
|
379 |
{
|
380 |
+
$bool = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
}
|
382 |
+
if($bool)
|
383 |
+
{
|
384 |
+
return true;
|
385 |
+
}
|
386 |
+
else
|
387 |
+
{
|
388 |
+
return false;
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
public function getOrderStatus($orderId)
|
393 |
+
{
|
394 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
395 |
+
if($order)
|
396 |
+
{
|
397 |
+
$status = $order->getStatusLabel();
|
398 |
+
return $status;
|
399 |
+
}
|
400 |
+
else
|
401 |
+
{
|
402 |
+
return false;
|
403 |
+
}
|
404 |
+
}
|
405 |
|
406 |
}
|
407 |
?>
|
app/code/local/Yfs/Ecomm/etc/api.xml
CHANGED
@@ -21,6 +21,10 @@
|
|
21 |
<updateProduct translate="title" module="yfs_ecomm">
|
22 |
<title>Update Product</title>
|
23 |
</updateProduct>
|
|
|
|
|
|
|
|
|
24 |
</methods>
|
25 |
</catalog>
|
26 |
<sales translate="title" module="yfs_ecomm">
|
21 |
<updateProduct translate="title" module="yfs_ecomm">
|
22 |
<title>Update Product</title>
|
23 |
</updateProduct>
|
24 |
+
<Timezone translate="title" module="yfs_ecomm">
|
25 |
+
<title>Get Timezone</title>
|
26 |
+
</Timezone>
|
27 |
+
|
28 |
</methods>
|
29 |
</catalog>
|
30 |
<sales translate="title" module="yfs_ecomm">
|
app/etc/modules/Yfs_Ecomm.xml
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Yfs_Ecomm>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>local</codePool>
|
7 |
-
</Yfs_Ecomm>
|
8 |
-
</modules>
|
9 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Yfs_Ecomm</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Orderhive allows admin to manage inventory, orders, shipping and contacts from a single interface.</summary>
|
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</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-
|
14 |
-
<time>07:
|
15 |
-
<contents><target name="magelocal"><dir name="Yfs"><dir name="Ecomm"><dir name="Helper"><file name="Data.php" hash="255648b1584edd335fb243a5c3488b5c"/></dir><dir name="Model"><dir name="Catalog"><file name="Api.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Yfs_Ecomm</name>
|
4 |
+
<version>1.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Orderhive allows admin to manage inventory, orders, shipping and contacts from a single interface.</summary>
|
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-05-31</date>
|
14 |
+
<time>07:19:54</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Yfs"><dir name="Ecomm"><dir name="Helper"><file name="Data.php" hash="255648b1584edd335fb243a5c3488b5c"/></dir><dir name="Model"><dir name="Catalog"><file name="Api.php" hash="713404ef7d4f722dcf28f48f6eefdc5f"/></dir><dir name="Customer"><file name="Api.php" hash="1f1a0a75a96d218096a8a6dba13150ac"/></dir><dir name="Sales"><file name="Api.php" hash="e4a2bdb1ae978899d4d99aa94f4b9186"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d8a1e1b41c8f96aaa6f45464a3a6e258"/><file name="api.xml" hash="6b5dfd2eb8a520c3687cee9464ec73ba"/><file name="config.xml" hash="424f465679881b4cdd5375bf315d4f34"/><file name="system.xml" hash="4d0f5d29e6f53f82da3de08cd543f643"/></dir></dir></dir></target><target name="magecommunity"><dir name="."><file name="Yfs_Ecomm.xml" hash=""/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|