Version Notes
First Version 1.0.0
Download this release
Release Info
Developer | Jayneel |
Extension | Yfs_Ecomm |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Yfs/Ecomm/Helper/Data.php +8 -0
- app/code/local/Yfs/Ecomm/Model/Catalog/Api.php +102 -0
- app/code/local/Yfs/Ecomm/Model/Customer/Api.php +25 -0
- app/code/local/Yfs/Ecomm/Model/Sales/Api.php +304 -0
- app/code/local/Yfs/Ecomm/etc/adminhtml.xml +26 -0
- app/code/local/Yfs/Ecomm/etc/api.xml +67 -0
- app/code/local/Yfs/Ecomm/etc/config.xml +20 -0
- app/code/local/Yfs/Ecomm/etc/system.xml +46 -0
- app/etc/modules/Yfs_Ecomm.xml +9 -0
- package.xml +18 -0
app/code/local/Yfs/Ecomm/Helper/Data.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Yfs_Ecomm_Helper_Data extends Mage_Core_Helper_Abstract{
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
}
|
app/code/local/Yfs/Ecomm/Model/Catalog/Api.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Yfs_Ecomm_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
+
{
|
4 |
+
function _getOptionLabel($arg_attribute,$optionId)
|
5 |
+
{
|
6 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
7 |
+
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
8 |
+
|
9 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
10 |
+
$attribute = $attribute_model->load($attribute_code);
|
11 |
+
|
12 |
+
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
13 |
+
$options = $attribute_options_model->getAllOptions(false);
|
14 |
+
|
15 |
+
foreach($options as $option)
|
16 |
+
{
|
17 |
+
if ($option['value'] == $optionId)
|
18 |
+
{
|
19 |
+
$optionId = $option['label'];
|
20 |
+
break;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
return $optionId;
|
24 |
+
}
|
25 |
+
function _getAttributeType($attribute_code)
|
26 |
+
{
|
27 |
+
$attribute = Mage::getModel( 'eav/config' )->getAttribute( 'catalog_product' , $attribute_code );
|
28 |
+
return $attribute->getFrontendInput();
|
29 |
+
}
|
30 |
+
public function getProductsCount()
|
31 |
+
{
|
32 |
+
return Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('type_id', array('eq' => 'simple'))->getSize();
|
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 |
+
}
|
51 |
+
public function getProductInfo($id, $attributes = null, $size = null, $filters = null)
|
52 |
+
{
|
53 |
+
$pro = Mage::getModel('catalog/product')->load($id);
|
54 |
+
$visibility = $pro->getVisibility();
|
55 |
+
if($visibility == 1)
|
56 |
+
{
|
57 |
+
$parentId = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($id);
|
58 |
+
$product = Mage::getModel('catalog/product')->load($parentId);
|
59 |
+
}
|
60 |
+
else
|
61 |
+
{
|
62 |
+
$product = $pro;
|
63 |
+
}
|
64 |
+
$prodInfo = array();
|
65 |
+
$prodInfo['id'] = $pro->getId();
|
66 |
+
$prodInfo['name'] = $pro->getName();
|
67 |
+
$prodInfo['sku'] = $pro->getSku();
|
68 |
+
$prodInfo['description'] = $product->getDescription();
|
69 |
+
$prodInfo['price'] = $product->getPrice();
|
70 |
+
foreach($attributes as $attribute)
|
71 |
+
{
|
72 |
+
if($this->_getAttributeType($attribute) == 'select')
|
73 |
+
{
|
74 |
+
$label = $this->_getOptionLabel($attribute,$product->getData($attribute));
|
75 |
+
$prodInfo[$attribute] = $label;
|
76 |
+
}
|
77 |
+
else
|
78 |
+
$prodInfo[$attribute] = $product->getData($attribute);
|
79 |
+
}
|
80 |
+
if($size)
|
81 |
+
{
|
82 |
+
if($this->_getAttributeType($size) == 'select')
|
83 |
+
{
|
84 |
+
$label = $this->_getOptionLabel($size,$pro->getData($size));
|
85 |
+
$prodInfo[$size] = $label;
|
86 |
+
}
|
87 |
+
else
|
88 |
+
$prodInfo[$size] = $pro->getData($size);
|
89 |
+
}
|
90 |
+
$media = $product->getMediaGalleryImages()->getItems();
|
91 |
+
foreach($media as $image)
|
92 |
+
{
|
93 |
+
$prodInfo['media'][]= $image->getData();
|
94 |
+
}
|
95 |
+
return $prodInfo;
|
96 |
+
}
|
97 |
+
public function isExtensionEnabled()
|
98 |
+
{
|
99 |
+
return Mage::getStoreConfig('ecomm/ecomm/allow');
|
100 |
+
}
|
101 |
+
}
|
102 |
+
?>
|
app/code/local/Yfs/Ecomm/Model/Customer/Api.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Yfs_Ecomm_Model_Customer_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
+
{
|
4 |
+
public function getCustomerCount()
|
5 |
+
{
|
6 |
+
$output = Mage::getResourceModel('customer/customer_collection')->getAllIds();
|
7 |
+
return sizeof($output);
|
8 |
+
}
|
9 |
+
public function getCustomerIds()
|
10 |
+
{
|
11 |
+
return Mage::getResourceModel('customer/customer_collection')->getAllIds();
|
12 |
+
}
|
13 |
+
public function getCustomerInfo($customerId)
|
14 |
+
{
|
15 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
16 |
+
$custInfo = array();
|
17 |
+
$custInfo = $customer->getData();
|
18 |
+
foreach($customer->getAddresses() as $address)
|
19 |
+
{
|
20 |
+
$custInfo['addresses'][] = $address->getData();
|
21 |
+
}
|
22 |
+
return $custInfo;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
?>
|
app/code/local/Yfs/Ecomm/Model/Sales/Api.php
ADDED
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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');
|
28 |
+
$readConnection = $resource->getConnection('core_read');
|
29 |
+
$query = "SELECT COUNT('increment_id') FROM sales_flat_order";
|
30 |
+
$result = $readConnection->fetchAll($query);
|
31 |
+
return $result[0]["COUNT('increment_id')"];
|
32 |
+
}
|
33 |
+
public function getTaxConfig()
|
34 |
+
{
|
35 |
+
$resource = Mage::getSingleton('core/resource');
|
36 |
+
$readConnection = $resource->getConnection('core_read');
|
37 |
+
$query1 = "SELECT value
|
38 |
+
FROM `core_config_data`
|
39 |
+
WHERE `path` LIKE 'tax/calculation/price_includes_tax'";
|
40 |
+
$result1 = $readConnection->fetchAll($query1);
|
41 |
+
|
42 |
+
$tax_config = array();
|
43 |
+
|
44 |
+
$query2 = "SELECT value
|
45 |
+
FROM `core_config_data`
|
46 |
+
WHERE `path` LIKE 'tax/calculation/shipping_includes_tax'";
|
47 |
+
$result2 = $readConnection->fetchAll($query2);
|
48 |
+
|
49 |
+
if($result1[0]['value'] == 1)
|
50 |
+
$tax_config['price'] = 'inward';
|
51 |
+
else
|
52 |
+
$tax_config['price'] = 'outward';
|
53 |
+
if($result2[0]['value'] == 1)
|
54 |
+
$tax_config['shipping'] = 'inward';
|
55 |
+
else
|
56 |
+
$tax_config['shipping'] = 'outward';
|
57 |
+
return $tax_config;
|
58 |
+
|
59 |
+
}
|
60 |
+
public function getOrderIncrementIds($lastIncrementId)
|
61 |
+
{
|
62 |
+
$resource = Mage::getSingleton('core/resource');
|
63 |
+
$readConnection = $resource->getConnection('core_read');
|
64 |
+
$lastRecordId = 0;
|
65 |
+
if($lastIncrementId)
|
66 |
+
{
|
67 |
+
$getLastRecordQuery = "SELECT entity_id FROM sales_flat_order WHERE increment_id = ".$lastIncrementId;
|
68 |
+
$getLastRecord = $readConnection->fetchAll($getLastRecordQuery);
|
69 |
+
$lastRecordId = $getLastRecord[0]['entity_id'];
|
70 |
+
}
|
71 |
+
|
72 |
+
if($lastRecordId)
|
73 |
+
$query = "SELECT increment_id FROM sales_flat_order WHERE entity_id > ".$lastRecordId." LIMIT 1000" ;
|
74 |
+
else
|
75 |
+
$query = "SELECT increment_id FROM sales_flat_order LIMIT 1000" ;
|
76 |
+
$result = $readConnection->fetchAll($query);
|
77 |
+
$increment_ids = array();
|
78 |
+
foreach($result as $order)
|
79 |
+
{
|
80 |
+
$increment_ids[] = $order['increment_id'];
|
81 |
+
}
|
82 |
+
return array('count' => sizeof($result),'increment_ids' => $increment_ids);
|
83 |
+
}
|
84 |
+
public function getOrderInfo($increment_id,$filters = null)
|
85 |
+
{
|
86 |
+
//load order using the increment id
|
87 |
+
|
88 |
+
$order = Mage::getModel('sales/order')
|
89 |
+
->getCollection()
|
90 |
+
->addAttributeToFilter('increment_id', $increment_id)
|
91 |
+
->getFirstItem();
|
92 |
+
|
93 |
+
$orderInfo = array();
|
94 |
+
|
95 |
+
$shippingId = $order->getShippingAddress()->getId();
|
96 |
+
$billingId = $order->getBillingAddress()->getId();
|
97 |
+
|
98 |
+
$shippingAddress = Mage::getModel('sales/order_address')->load($shippingId);
|
99 |
+
$billingAddress = Mage::getModel('sales/order_address')->load($billingId);
|
100 |
+
|
101 |
+
$orderInfo['increment_id'] = $order->getData('increment_id');
|
102 |
+
|
103 |
+
$orderInfo['created_at'] = $order->getData('created_at');
|
104 |
+
$orderInfo['updated_at'] = $order->getData('updated_at');
|
105 |
+
$orderInfo['status'] = $order->getData('status');
|
106 |
+
$orderInfo['customer_first_name'] = $order->getData('customer_firstname');
|
107 |
+
$orderInfo['customer_middle_name'] = $order->getData('customer_middlename');
|
108 |
+
$orderInfo['customer_last_name'] = $order->getData('customer_lastname');
|
109 |
+
$orderInfo['customer_email'] = $order->getData('customer_email');
|
110 |
+
|
111 |
+
$orderInfo['shipping_address'] = $shippingAddress->getData();
|
112 |
+
$orderInfo['billing_address'] = $billingAddress->getData();
|
113 |
+
$orderInfo['shipping_method'] = $order->getData('shipping_method');
|
114 |
+
|
115 |
+
$orderInfo['shipping_charges'] = $order->getShippingAmount();
|
116 |
+
$orderInfo['subtotal'] = $order->getData('subtotal');
|
117 |
+
$orderInfo['tax'] = $order->getData('base_tax_amount');
|
118 |
+
$orderInfo['discount'] = $order->getData('base_discount_amount');
|
119 |
+
$orderInfo['row_total'] = $order->getData('row_total');
|
120 |
+
$orderInfo['order_totals'] = $order->getData('base_grand_total');
|
121 |
+
$shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')->setOrderFilter($order)->load();
|
122 |
+
foreach ($shipmentCollection as $shipment)
|
123 |
+
{
|
124 |
+
foreach($shipment->getAllTracks() as $tracknum)
|
125 |
+
{
|
126 |
+
$tracknums[]=$tracknum->getNumber();
|
127 |
+
}
|
128 |
+
}
|
129 |
+
$orderInfo['tracking_numbers'] = $tracknums;
|
130 |
+
|
131 |
+
$comments = array();
|
132 |
+
$orderComments = $order->getAllStatusHistory();
|
133 |
+
foreach ($orderComments as $comment)
|
134 |
+
{
|
135 |
+
$comments[] = $comment->getData('comment');
|
136 |
+
}
|
137 |
+
$orderInfo['comments'] = $comments;
|
138 |
+
$payment = $order->getPayment();
|
139 |
+
$method = $payment->getMethodInstance();
|
140 |
+
$orderInfo['payment'] = $method->getTitle();
|
141 |
+
if($order->getData('cod_fee'))
|
142 |
+
$orderInfo['payment_charges'] = $order->getData('cod_fee');
|
143 |
+
else
|
144 |
+
$orderInfo['payment_charges'] = 0;
|
145 |
+
|
146 |
+
$items = $order->getAllItems();
|
147 |
+
$orderToSend = array();
|
148 |
+
$count = 1;
|
149 |
+
foreach($items as $key => $item)
|
150 |
+
{
|
151 |
+
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
152 |
+
if($product && $product->getTypeId()=='simple')
|
153 |
+
{
|
154 |
+
$itemToSend['item']['id'] = $item->getItemId();
|
155 |
+
$itemToSend['item']['name'] = $item->getName();
|
156 |
+
$itemToSend['item']['sku'] = $item->getSku();
|
157 |
+
$itemToSend['item']['qty'] = 1;//$item->getQtyOrdered();
|
158 |
+
if($product->getData('visibility') == 1)
|
159 |
+
{
|
160 |
+
$itemToSend['item']['price'] = $items[$key-1]->getPrice();
|
161 |
+
$itemToSend['item']['discount_amount'] = $items[$key-1]->getData('discount_amount');
|
162 |
+
$itemToSend['item']['discount_percent'] = $items[$key-1]->getData('discount_percent');
|
163 |
+
}
|
164 |
+
else
|
165 |
+
{
|
166 |
+
$itemToSend['item']['price'] = $item->getPrice();
|
167 |
+
$itemToSend['item']['discount_amount'] = $item->getData('discount_amount');
|
168 |
+
$itemToSend['item']['discount_percent'] = $item->getData('discount_percent');
|
169 |
+
}
|
170 |
+
for($i = 0 ; $i < $item->getQtyOrdered(); $i++)
|
171 |
+
{
|
172 |
+
$orderToSend[$count]['item'] = $itemToSend['item'];
|
173 |
+
$orderInfo['increment_id_new'] = $orderInfo['increment_id'].'_'.($count);
|
174 |
+
$orderToSend[$count]['order'] = $orderInfo;
|
175 |
+
$count++;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
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 |
+
//For oms addedd by Arjun on 09 Oct 2013 1:21 PM
|
190 |
+
public function _getOptionLabel($arg_attribute,$optionId)
|
191 |
+
{
|
192 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
193 |
+
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
|
194 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
195 |
+
$attribute = $attribute_model->load($attribute_code);
|
196 |
+
$attribute_table = $attribute_options_model->setAttribute($attribute);
|
197 |
+
$options = $attribute_options_model->getAllOptions(false);
|
198 |
+
foreach($options as $option)
|
199 |
+
{
|
200 |
+
if ($option['value'] == $optionId)
|
201 |
+
{
|
202 |
+
$optionId = $option['label'];
|
203 |
+
break;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
return $optionId;
|
207 |
+
}
|
208 |
+
|
209 |
+
//For oms addedd by Arjun on 09 Oct 2013 1:21 PM
|
210 |
+
public function getOrderByStatus($status,$fromDate,$toDate)
|
211 |
+
{
|
212 |
+
switch ($status) {
|
213 |
+
case 'pending' : break;
|
214 |
+
|
215 |
+
//default: return "Invalid Order status";
|
216 |
+
}
|
217 |
+
|
218 |
+
try {
|
219 |
+
|
220 |
+
$orders=Mage::getModel('sales/mysql4_order_collection');
|
221 |
+
//Optional filters you might want to use - more available operations in method _getConditionSql in Varien_Data_Collection_Db.
|
222 |
+
$orders->addFieldToFilter('status',Array('eq'=>$status));
|
223 |
+
$orders->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate));
|
224 |
+
$allIds = $orders->getAllIds();
|
225 |
+
if(empty($allIds)) return $pendingOrders;
|
226 |
+
$orderIndex = 0;
|
227 |
+
foreach($allIds as $thisId)
|
228 |
+
{
|
229 |
+
$myOrder=Mage::getModel('sales/order');
|
230 |
+
$tempOrder = $myOrder->load($thisId);
|
231 |
+
$orderData = $tempOrder->getData();
|
232 |
+
$shippingAdd = $tempOrder->getShippingAddress()->getData();
|
233 |
+
$paymentData =$tempOrder->getPayment()->getData();
|
234 |
+
$pOrder = array();
|
235 |
+
$pendingItems = array();
|
236 |
+
$itemIndex = 0;
|
237 |
+
foreach ($tempOrder->getItemsCollection() as $item)
|
238 |
+
{
|
239 |
+
$pItem = array();
|
240 |
+
$itemData = $item->getData();
|
241 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());
|
242 |
+
$optionId = $product->getData('size');
|
243 |
+
if($itemData['parent_item_id'])
|
244 |
+
{
|
245 |
+
continue;
|
246 |
+
}
|
247 |
+
$pItem['item_id'] = $itemData['item_id'];
|
248 |
+
$pItem['name'] = $itemData['name'];
|
249 |
+
$pItem['qty_ordered'] = $itemData['qty_ordered'];
|
250 |
+
$pItem['size'] = $this->_getOptionLabel('size',$optionId);
|
251 |
+
$pItem['product_type'] = $item->getProductType();
|
252 |
+
$pItem['product_id'] = $itemData['product_id'];
|
253 |
+
$pItem['product_options'] = $itemData['product_options'];
|
254 |
+
$pItem['sku'] = $itemData['sku'];
|
255 |
+
$pItem['discount_amount'] = $itemData['discount_amount'];
|
256 |
+
$pItem['base_price'] = $itemData['base_price'];
|
257 |
+
$pItem['base_price_incl_tax'] = $itemData['base_price_incl_tax'];
|
258 |
+
$pItem['row_total_incl_tax'] = $itemData['row_total_incl_tax'];
|
259 |
+
$pItem['tax_percent'] = $itemData['tax_percent'];
|
260 |
+
$pItem['tax_amount' ] = $itemData['tax_amount'];
|
261 |
+
$itemIndex++;
|
262 |
+
$pendingItems['item'.$itemIndex] = $pItem;
|
263 |
+
}
|
264 |
+
$pOrder['increment_id'] = $orderData['increment_id'];
|
265 |
+
$pOrder['entity_id'] = $orderData['entity_id'];
|
266 |
+
$pOrder['status'] = $tempOrder->getStatus();
|
267 |
+
$pOrder['grand_total'] = $orderData['grand_total'];
|
268 |
+
$pOrder['billing_address_id'] = $tempOrder->getBillingAddress()->getId();
|
269 |
+
$pOrder['customer_group_id'] = $orderData['customer_group_id'];
|
270 |
+
$pOrder['shipping_address_id'] = $tempOrder->getShippingAddress()->getId();
|
271 |
+
$pOrder['created_at'] = $orderData['created_at'];
|
272 |
+
$pOrder['cod_fee'] = $orderData['cod_fee'];
|
273 |
+
$pOrder['base_discount_amount'] = $orderData['base_discount_amount'];
|
274 |
+
$pOrder['base_subtotal_incl_tax'] = $orderData['base_subtotal_incl_tax'];
|
275 |
+
$pOrder['updated_at'] = $orderData['updated_at'];
|
276 |
+
$pOrder['customer_email'] = $orderData['customer_email'];
|
277 |
+
$pOrder['shipping_amount'] = $orderData['shipping_amount'];
|
278 |
+
$pOrder['payment_method'] = $paymentData['method'];
|
279 |
+
$pOrder['firstname'] = $shippingAdd['firstname'];
|
280 |
+
$pOrder['middlename'] = $shippingAdd['middlename'];
|
281 |
+
$pOrder['lastname'] = $shippingAdd['lastname'];
|
282 |
+
$pOrder['street'] = $shippingAdd['street'];
|
283 |
+
$pOrder['city'] = $shippingAdd['city'];
|
284 |
+
$pOrder['region'] = $shippingAdd['region'];
|
285 |
+
$pOrder['country_id' ] = $shippingAdd['country_id'];
|
286 |
+
$pOrder['postcode'] = $shippingAdd['postcode'];
|
287 |
+
$pOrder['telephone'] = $shippingAdd['telephone'];
|
288 |
+
$pOrder['items'] = $pendingItems;
|
289 |
+
$orderIndex++;
|
290 |
+
$pendingOrders['order'.$orderIndex] = $pOrder;
|
291 |
+
//if($orderIndex == 7) return $pendingOrders;
|
292 |
+
}
|
293 |
+
return $pendingOrders;
|
294 |
+
//return $orderIndex;
|
295 |
+
}catch(Exception $e)
|
296 |
+
{
|
297 |
+
// return $orderIndex;
|
298 |
+
return $e->getMessage();
|
299 |
+
}
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
}
|
304 |
+
?>
|
app/code/local/Yfs/Ecomm/etc/adminhtml.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<ecomm translate="title">
|
15 |
+
<title>Orderhive Integration</title>
|
16 |
+
<sort_order>100</sort_order>
|
17 |
+
</ecomm>
|
18 |
+
</children>
|
19 |
+
</config>
|
20 |
+
</children>
|
21 |
+
</system>
|
22 |
+
</children>
|
23 |
+
</admin>
|
24 |
+
</resources>
|
25 |
+
</acl>
|
26 |
+
</config>
|
app/code/local/Yfs/Ecomm/etc/api.xml
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<api>
|
4 |
+
<resources>
|
5 |
+
<catalog translate="title" module="yfs_ecomm">
|
6 |
+
<title>Catalog</title>
|
7 |
+
<model>ecomm/catalog_api</model>
|
8 |
+
<methods>
|
9 |
+
<getProductsCount translate="title" module="yfs_ecomm">
|
10 |
+
<title>Number of Products</title>
|
11 |
+
</getProductsCount>
|
12 |
+
<getProducts translate="title" module="yfs_ecomm">
|
13 |
+
<title>List of Products</title>
|
14 |
+
</getProducts>
|
15 |
+
<getProductInfo translate="title" module="yfs_ecomm">
|
16 |
+
<title>Product Information</title>
|
17 |
+
</getProductInfo>
|
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>
|
31 |
+
<model>ecomm/sales_api</model>
|
32 |
+
<methods>
|
33 |
+
<getOrderIncrementIdCount translate="title" module="yfs_ecomm">
|
34 |
+
<title>Count of Order Increment Ids</title>
|
35 |
+
</getOrderIncrementIdCount>
|
36 |
+
<getOrderIncrementIds translate="title" module="yfs_ecomm">
|
37 |
+
<title>List of Order Increment Ids</title>
|
38 |
+
</getOrderIncrementIds>
|
39 |
+
<getOrderInfo translate="title" module="yfs_ecomm">
|
40 |
+
<title>Order Information</title>
|
41 |
+
</getOrderInfo>
|
42 |
+
<getTaxConfig translate="title" module="yfs_ecomm">
|
43 |
+
<title>Tax Configuration</title>
|
44 |
+
</getTaxConfig>
|
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">
|
51 |
+
<title>Customer</title>
|
52 |
+
<model>ecomm/customer_api</model>
|
53 |
+
<methods>
|
54 |
+
<getCustomerCount translate="title" module="yfs_ecomm">
|
55 |
+
<title>Customer Count</title>
|
56 |
+
</getCustomerCount>
|
57 |
+
<getCustomerIds translate="title" module="yfs_ecomm">
|
58 |
+
<title>List Customer entity id</title>
|
59 |
+
</getCustomerIds>
|
60 |
+
<getCustomerInfo translate="title" module="yfs_ecomm">
|
61 |
+
<title>Customer Info</title>
|
62 |
+
</getCustomerInfo>
|
63 |
+
</methods>
|
64 |
+
</customer>
|
65 |
+
</resources>
|
66 |
+
</api>
|
67 |
+
</config>
|
app/code/local/Yfs/Ecomm/etc/config.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Yfs_Ecomm>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Yfs_Ecomm>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<ecomm>
|
11 |
+
<class>Yfs_Ecomm_Model</class>
|
12 |
+
</ecomm>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<ecomm>
|
16 |
+
<class>Yfs_Ecomm_Helper</class>
|
17 |
+
</ecomm>
|
18 |
+
</helpers>
|
19 |
+
</global>
|
20 |
+
</config>
|
app/code/local/Yfs/Ecomm/etc/system.xml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<tabs>
|
5 |
+
<ecomm translate="label" module="ecomm">
|
6 |
+
<label>Orderhive Integration</label>
|
7 |
+
<sort_order>200</sort_order>
|
8 |
+
</ecomm>
|
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>
|
16 |
+
<sort_order>100</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<groups>
|
21 |
+
<ecomm translate="label">
|
22 |
+
<label>Orderhive Integration</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>10</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 |
+
<fields>
|
29 |
+
<allow translate="label">
|
30 |
+
<label>Enable</label>
|
31 |
+
<comment>Allow Orderhive to access products, customers and orders.</comment>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</allow>
|
39 |
+
|
40 |
+
</fields>
|
41 |
+
</ecomm>
|
42 |
+
</groups>
|
43 |
+
</ecomm>
|
44 |
+
|
45 |
+
</sections>
|
46 |
+
</config>
|
app/etc/modules/Yfs_Ecomm.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Yfs_Ecomm</name>
|
4 |
+
<version>1.0.0</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’s performance. It provides an interface to revoke permission from Orderhive in order to stop API calls.</description>
|
11 |
+
<notes>First Version 1.0.0</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>2013-12-18</date>
|
14 |
+
<time>06:34:21</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="b52a4c79fe4fea5e7245d792b835a2a7"/></dir><dir name="Customer"><file name="Api.php" hash="1f1a0a75a96d218096a8a6dba13150ac"/></dir><dir name="Sales"><file name="Api.php" hash="1be11cccf8147d34f284632a4350188a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d8a1e1b41c8f96aaa6f45464a3a6e258"/><file name="api.xml" hash="0c9424212ec502dce488a517a1a6d507"/><file name="config.xml" hash="424f465679881b4cdd5375bf315d4f34"/><file name="system.xml" hash="578e747fc1ad8f3492d191a326446fd2"/></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>
|