Version Notes
Bug fixes in sync process
Download this release
Release Info
Developer | Jayneel |
Extension | Yfs_Ecomm |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
app/code/local/Yfs/Ecomm/Model/Catalog/Api.php
CHANGED
@@ -33,18 +33,6 @@ class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
|
33 |
}
|
34 |
public function getProducts()
|
35 |
{
|
36 |
-
/*$collection = Mage::getModel('catalog/product')
|
37 |
-
->getCollection()
|
38 |
-
->addAttributeToSelect('*');
|
39 |
-
$products = array();
|
40 |
-
foreach($collection as $product)
|
41 |
-
{
|
42 |
-
$id = $product->getId();
|
43 |
-
$products[$id]['id'] = $product->getId();
|
44 |
-
$products[$id]['name'] = $product->getName();
|
45 |
-
$products[$id]['sku'] = $product->getSku();
|
46 |
-
}
|
47 |
-
return $products;*/
|
48 |
$collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToFilter('type_id', array('eq' => 'simple'));
|
49 |
return $collection->getAllIds();
|
50 |
}
|
@@ -94,6 +82,38 @@ class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
|
94 |
}
|
95 |
return $prodInfo;
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
public function isExtensionEnabled()
|
98 |
{
|
99 |
return Mage::getStoreConfig('ecomm/ecomm/allow');
|
33 |
}
|
34 |
public function getProducts()
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
$collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToFilter('type_id', array('eq' => 'simple'));
|
37 |
return $collection->getAllIds();
|
38 |
}
|
82 |
}
|
83 |
return $prodInfo;
|
84 |
}
|
85 |
+
|
86 |
+
public function updateProduct($sku, $price = null, $quantity = null)
|
87 |
+
{
|
88 |
+
$product1 = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
|
89 |
+
if($product1)
|
90 |
+
{
|
91 |
+
$product = Mage::getModel('catalog/product')->load($product1->getId());
|
92 |
+
if($product)
|
93 |
+
{
|
94 |
+
|
95 |
+
$product->setPrice($price);
|
96 |
+
|
97 |
+
$stockItem = $product->getStockItem();
|
98 |
+
$stockItem->setData('qty', $quantity);
|
99 |
+
|
100 |
+
if($stockItem->save() && $product->save())
|
101 |
+
{
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
else
|
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');
|
app/code/local/Yfs/Ecomm/Model/Sales/Api.php
CHANGED
@@ -1,27 +1,6 @@
|
|
1 |
<?php
|
2 |
class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
{
|
4 |
-
/*protected $_orderAttributesList = array(
|
5 |
-
'increment_id',
|
6 |
-
'created_at',
|
7 |
-
'updated_at',
|
8 |
-
'status',
|
9 |
-
'customer_firstname',
|
10 |
-
'customer_middlename',
|
11 |
-
'customer_lastname',
|
12 |
-
'customer_email',
|
13 |
-
'shipping_address',
|
14 |
-
'billing_address',
|
15 |
-
'payment',
|
16 |
-
'shipping_method',
|
17 |
-
'items',
|
18 |
-
'subtotal',
|
19 |
-
'tax',
|
20 |
-
'discount',
|
21 |
-
'row_total',
|
22 |
-
'comments',
|
23 |
-
'order_totals'
|
24 |
-
);*/
|
25 |
public function getOrderIncrementIdCount()
|
26 |
{
|
27 |
$resource = Mage::getSingleton('core/resource');
|
@@ -180,13 +159,9 @@ class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
|
180 |
return $orderToSend;
|
181 |
}
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
//For oms addedd by Arjun on 09 Oct 2013 1:21 PM
|
188 |
protected $pendingOrders = array();
|
189 |
-
|
190 |
public function _getOptionLabel($arg_attribute,$optionId)
|
191 |
{
|
192 |
$attribute_model = Mage::getModel('eav/entity_attribute');
|
@@ -206,7 +181,7 @@ class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
|
206 |
return $optionId;
|
207 |
}
|
208 |
|
209 |
-
|
210 |
public function getOrderByStatus($status,$fromDate,$toDate)
|
211 |
{
|
212 |
switch ($status) {
|
@@ -299,6 +274,113 @@ class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
|
299 |
}
|
300 |
|
301 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
|
303 |
}
|
304 |
?>
|
1 |
<?php
|
2 |
class Yfs_Ecomm_Model_Sales_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
public function getOrderIncrementIdCount()
|
5 |
{
|
6 |
$resource = Mage::getSingleton('core/resource');
|
159 |
return $orderToSend;
|
160 |
}
|
161 |
|
162 |
+
|
|
|
|
|
|
|
|
|
163 |
protected $pendingOrders = array();
|
164 |
+
|
165 |
public function _getOptionLabel($arg_attribute,$optionId)
|
166 |
{
|
167 |
$attribute_model = Mage::getModel('eav/entity_attribute');
|
181 |
return $optionId;
|
182 |
}
|
183 |
|
184 |
+
|
185 |
public function getOrderByStatus($status,$fromDate,$toDate)
|
186 |
{
|
187 |
switch ($status) {
|
274 |
}
|
275 |
|
276 |
}
|
277 |
+
|
278 |
+
public function updateOrderStatus($orderId,$status,$sku,$qty,$shipping_method_name,$tracking_number)
|
279 |
+
{
|
280 |
+
|
281 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
282 |
+
$items = $order->getItemsCollection();
|
283 |
+
$qtys = array();
|
284 |
+
$bool = false;
|
285 |
+
|
286 |
+
foreach($items as $item)
|
287 |
+
{
|
288 |
+
$Itemsku = $item->getSku();
|
289 |
+
if($Itemsku == $sku)
|
290 |
+
{
|
291 |
+
$qtys[$item->getId()] = $qty;
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
if($status == Confirmed || $status == confirmed)
|
296 |
+
{
|
297 |
+
if($qtys)
|
298 |
+
{
|
299 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($qtys);
|
300 |
+
|
301 |
+
$amount = $invoice->getGrandTotal();
|
302 |
+
$invoice->register()->pay();
|
303 |
+
$invoice->getOrder()->setIsInProcess(true);
|
304 |
+
|
305 |
+
$history = $invoice->getOrder()->addStatusHistoryComment(
|
306 |
+
'Partial amount of $' . $amount . ' captured automatically.', false
|
307 |
+
);
|
308 |
+
|
309 |
+
$history->setIsCustomerNotified(true);
|
310 |
+
|
311 |
+
$order->save();
|
312 |
+
|
313 |
+
Mage::getModel('core/resource_transaction')
|
314 |
+
->addObject($invoice)
|
315 |
+
->addObject($invoice->getOrder())
|
316 |
+
->save();
|
317 |
+
$invoice->save();
|
318 |
+
$invoice->sendEmail(true, '');
|
319 |
+
$bool = true;
|
320 |
+
}
|
321 |
+
}
|
322 |
+
else if($status == Shipped || $status == shipped)
|
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 |
+
public function getOrderStatus($orderId)
|
371 |
+
{
|
372 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
373 |
+
if($order)
|
374 |
+
{
|
375 |
+
$status = $order->getStatusLabel();
|
376 |
+
return $status;
|
377 |
+
}
|
378 |
+
else
|
379 |
+
{
|
380 |
+
return false;
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
384 |
|
385 |
}
|
386 |
?>
|
app/code/local/Yfs/Ecomm/etc/api.xml
CHANGED
@@ -18,13 +18,10 @@
|
|
18 |
<isExtensionEnabled translate="title" module="yfs_ecomm">
|
19 |
<title>Test the extension</title>
|
20 |
</isExtensionEnabled>
|
|
|
|
|
|
|
21 |
</methods>
|
22 |
-
<!-- <faults module="yfs_ecomm">
|
23 |
-
<product_not_exists>
|
24 |
-
<code>100</code>
|
25 |
-
<message>Product not found with requested id</message>
|
26 |
-
</product_not_exists>
|
27 |
-
</faults> -->
|
28 |
</catalog>
|
29 |
<sales translate="title" module="yfs_ecomm">
|
30 |
<title>Sales</title>
|
@@ -45,6 +42,12 @@
|
|
45 |
<getOrderByStatus translate="title" module="yfs_ecomm">
|
46 |
<title>Tax Configuration</title>
|
47 |
</getOrderByStatus>
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
</methods>
|
49 |
</sales>
|
50 |
<customer translate="title" module="yfs_ecomm">
|
18 |
<isExtensionEnabled translate="title" module="yfs_ecomm">
|
19 |
<title>Test the extension</title>
|
20 |
</isExtensionEnabled>
|
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">
|
27 |
<title>Sales</title>
|
42 |
<getOrderByStatus translate="title" module="yfs_ecomm">
|
43 |
<title>Tax Configuration</title>
|
44 |
</getOrderByStatus>
|
45 |
+
<updateOrderStatus translate="title" module="yfs_ecomm">
|
46 |
+
<title>Update Order Status</title>
|
47 |
+
</updateOrderStatus>
|
48 |
+
<getOrderStatus translate="title" module="yfs_ecomm">
|
49 |
+
<title>Get Order Status</title>
|
50 |
+
</getOrderStatus>
|
51 |
</methods>
|
52 |
</sales>
|
53 |
<customer translate="title" module="yfs_ecomm">
|
app/code/local/Yfs/Ecomm/etc/system.xml
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
</tabs>
|
10 |
<sections>
|
11 |
<ecomm translate="label" module="ecomm">
|
12 |
-
|
13 |
<label>Settings</label>
|
14 |
<tab>ecomm</tab>
|
15 |
<frontend_type>text</frontend_type>
|
@@ -28,7 +28,34 @@
|
|
28 |
<fields>
|
29 |
<allow translate="label">
|
30 |
<label>Enable</label>
|
31 |
-
<comment>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
<frontend_type>select</frontend_type>
|
33 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
<sort_order>1</sort_order>
|
9 |
</tabs>
|
10 |
<sections>
|
11 |
<ecomm translate="label" module="ecomm">
|
12 |
+
<class>separator-top</class>
|
13 |
<label>Settings</label>
|
14 |
<tab>ecomm</tab>
|
15 |
<frontend_type>text</frontend_type>
|
28 |
<fields>
|
29 |
<allow translate="label">
|
30 |
<label>Enable</label>
|
31 |
+
<comment>
|
32 |
+
<![CDATA[Allow Orderhive to access Products, Customers and Orders.
|
33 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
34 |
+
Orderhive Magento extension is successfully installed!
|
35 |
+
</span>
|
36 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
37 |
+
To initiate sync of Magento products, customers and orders head back<a href="http://www.orderhive.com/free-trial.html" target="_blank"> to your Orderhive account</a> and follow the below steps:
|
38 |
+
</span>
|
39 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
40 |
+
1. Go to ‘Channels’.
|
41 |
+
</span>
|
42 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
43 |
+
2. Go to ‘Add Magento channel’> Click on ‘More information'.
|
44 |
+
</span>
|
45 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
46 |
+
3. Follow the steps specified in the tab.
|
47 |
+
</span>
|
48 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
49 |
+
4. Click on 'Settings', fill in the required details of your Magento Store.
|
50 |
+
</span>
|
51 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
52 |
+
5. Click on ‘Submit’.
|
53 |
+
</span>
|
54 |
+
<span style="float: left; display: block; width: 100%;font-size:11px;color:#2F2F2F;margin-top:5px;">
|
55 |
+
Orderhive will now start bringing products, orders and customers from your Magento store.
|
56 |
+
</span>
|
57 |
+
]]>
|
58 |
+
</comment>
|
59 |
<frontend_type>select</frontend_type>
|
60 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
61 |
<sort_order>1</sort_order>
|
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
|
11 |
-
<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>
|
14 |
-
<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="
|
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.1</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</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-02-01</date>
|
14 |
+
<time>07:32:27</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="89c0fc7a1d61e42f7b68d5bc6d16c7fb"/></dir><dir name="Customer"><file name="Api.php" hash="1f1a0a75a96d218096a8a6dba13150ac"/></dir><dir name="Sales"><file name="Api.php" hash="ff98d71e9a1cdfca4e15348c8f5cde9b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d8a1e1b41c8f96aaa6f45464a3a6e258"/><file name="api.xml" hash="df737124792e5abd02c9b2b3457ade3e"/><file name="config.xml" hash="424f465679881b4cdd5375bf315d4f34"/><file name="system.xml" hash="4d0f5d29e6f53f82da3de08cd543f643"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Yfs_Ecomm.xml" hash="92cf46671c629456dfefa5313749ffa8"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|