Version Notes
Added more details product retrieval API methods.
Download this release
Release Info
Developer | FarApp |
Extension | FarApp_Connector |
Version | 1.2.9 |
Comparing to | |
See all releases |
Code changes from version 1.2.8 to 1.2.9
- app/code/community/FarApp/Connector/Model/Product/Api.php +84 -0
- app/code/community/FarApp/Connector/controllers/ExportController.php +3 -2
- app/code/community/FarApp/Connector/etc/api.xml +13 -0
- app/code/community/FarApp/Connector/etc/config.xml +6 -1
- app/code/community/FarApp/Connector/etc/wsdl.xml +14 -0
- package.xml +5 -5
app/code/community/FarApp/Connector/Model/Product/Api.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class FarApp_Connector_Model_Product_Api extends Mage_Catalog_Model_Product_Api
|
4 |
+
{
|
5 |
+
public function items($filters = null, $store = null, $detailed = false)
|
6 |
+
{
|
7 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
8 |
+
->addStoreFilter($this->_getStoreId($store))
|
9 |
+
->addAttributeToSelect('name');
|
10 |
+
|
11 |
+
/** @var $apiHelper Mage_Api_Helper_Data */
|
12 |
+
$apiHelper = Mage::helper('api');
|
13 |
+
$filters = $apiHelper->parseFilters($filters, $this->_filtersMap);
|
14 |
+
Mage::log('HI0.6');
|
15 |
+
try {
|
16 |
+
Mage::log('HI0.61');
|
17 |
+
foreach ($filters as $field => $value) {
|
18 |
+
Mage::log('HI0.62 '.$field.' '.$value);
|
19 |
+
$collection->addFieldToFilter($field, $value);
|
20 |
+
}
|
21 |
+
} catch (Mage_Core_Exception $e) {
|
22 |
+
$this->_fault('filters_invalid', $e->getMessage());
|
23 |
+
}
|
24 |
+
$result = array();
|
25 |
+
foreach ($collection as $product) {
|
26 |
+
if (!$detailed) {
|
27 |
+
$result[] = array(
|
28 |
+
'product_id' => $product->getId(),
|
29 |
+
'sku' => $product->getSku(),
|
30 |
+
'name' => $product->getName(),
|
31 |
+
'set' => $product->getAttributeSetId(),
|
32 |
+
'type' => $product->getTypeId(),
|
33 |
+
'category_ids' => $product->getCategoryIds(),
|
34 |
+
'website_ids' => $product->getWebsiteIds()
|
35 |
+
);
|
36 |
+
}
|
37 |
+
else {
|
38 |
+
$productDetails = $this->info($product->getId(), null, null, null, true);
|
39 |
+
$mediaApi = new Mage_Catalog_Model_Product_Attribute_Media_Api();
|
40 |
+
$mediaList = $mediaApi->items($product->getId());
|
41 |
+
$productDetails['product_media.list'] = $mediaList;
|
42 |
+
$result[] = $productDetails;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
return $result;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function info($productId, $store = null, $attributes = null, $identifierType = null, $detailed = false)
|
49 |
+
{
|
50 |
+
// make sku flag case-insensitive
|
51 |
+
if (!empty($identifierType)) {
|
52 |
+
$identifierType = strtolower($identifierType);
|
53 |
+
}
|
54 |
+
|
55 |
+
$product = $this->_getProduct($productId, $store, $identifierType);
|
56 |
+
|
57 |
+
$result = array( // Basic product data
|
58 |
+
'product_id' => $product->getId(),
|
59 |
+
'sku' => $product->getSku(),
|
60 |
+
'set' => $product->getAttributeSetId(),
|
61 |
+
'type' => $product->getTypeId(),
|
62 |
+
'categories' => $product->getCategoryIds(),
|
63 |
+
'websites' => $product->getWebsiteIds()
|
64 |
+
);
|
65 |
+
|
66 |
+
foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
|
67 |
+
if ($this->_isAllowedAttribute($attribute, $attributes)) {
|
68 |
+
if ($detailed && $attribute->usesSource()) {
|
69 |
+
$result[$attribute->getAttributeCode()] = $product->getAttributeText(
|
70 |
+
$attribute->getAttributeCode());
|
71 |
+
}
|
72 |
+
else {
|
73 |
+
$result[$attribute->getAttributeCode()] = $product->getData(
|
74 |
+
$attribute->getAttributeCode());
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
return $result;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
?>
|
84 |
+
|
app/code/community/FarApp/Connector/controllers/ExportController.php
CHANGED
@@ -172,6 +172,7 @@ class FarApp_Connector_ExportController extends Mage_Core_Controller_Front_Actio
|
|
172 |
}
|
173 |
|
174 |
try {
|
|
|
175 |
/** @var $model Mage_ImportExport_Model_Export */
|
176 |
$model = Mage::getModel('importexport/export');
|
177 |
$model->setData($this->getRequest()->getParams());
|
@@ -183,11 +184,11 @@ class FarApp_Connector_ExportController extends Mage_Core_Controller_Front_Actio
|
|
183 |
);
|
184 |
} catch (Mage_Core_Exception $e) {
|
185 |
echo $e->getMessage();
|
186 |
-
|
187 |
} catch (Exception $e) {
|
188 |
echo $this->__('No valid data sent');
|
189 |
Mage::logException($e);
|
190 |
-
|
191 |
}
|
192 |
return;
|
193 |
|
172 |
}
|
173 |
|
174 |
try {
|
175 |
+
Mage::app()->setCurrentStore('admin');
|
176 |
/** @var $model Mage_ImportExport_Model_Export */
|
177 |
$model = Mage::getModel('importexport/export');
|
178 |
$model->setData($this->getRequest()->getParams());
|
184 |
);
|
185 |
} catch (Mage_Core_Exception $e) {
|
186 |
echo $e->getMessage();
|
187 |
+
Mage::getSingleton('admin/session')->addError($e->getMessage());
|
188 |
} catch (Exception $e) {
|
189 |
echo $this->__('No valid data sent');
|
190 |
Mage::logException($e);
|
191 |
+
Mage::getSingleton('admin/session')->addError($this->__('No valid data sent'));
|
192 |
}
|
193 |
return;
|
194 |
|
app/code/community/FarApp/Connector/etc/api.xml
CHANGED
@@ -11,6 +11,19 @@
|
|
11 |
</capture>
|
12 |
</methods>
|
13 |
</farapp_connector_order_invoice>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
</resources>
|
15 |
</api>
|
16 |
</config>
|
11 |
</capture>
|
12 |
</methods>
|
13 |
</farapp_connector_order_invoice>
|
14 |
+
<farapp_connector_product translate="title" module="farapp_connector">
|
15 |
+
<title>FarApp Connector Product API</title>
|
16 |
+
<model>farapp_connector/product_api</model>
|
17 |
+
<methods>
|
18 |
+
<list translate="title" module="farapp_connector">
|
19 |
+
<title>Adds detailed parameter to products list</title>
|
20 |
+
<method>items</method>
|
21 |
+
</list>
|
22 |
+
<info translate="title" module="farapp_connector">
|
23 |
+
<title>Adds detailed parameter to product info</title>
|
24 |
+
</info>
|
25 |
+
</methods>
|
26 |
+
</farapp_connector_product>
|
27 |
</resources>
|
28 |
</api>
|
29 |
</config>
|
app/code/community/FarApp/Connector/etc/config.xml
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
<config>
|
10 |
<modules>
|
11 |
<FarApp_Connector>
|
12 |
-
<version>1.2.
|
13 |
</FarApp_Connector>
|
14 |
</modules>
|
15 |
<global>
|
@@ -23,6 +23,11 @@
|
|
23 |
<order_creditmemo_api>FarApp_Connector_Model_Order_Creditmemo_Api</order_creditmemo_api>
|
24 |
</rewrite>
|
25 |
</sales>
|
|
|
|
|
|
|
|
|
|
|
26 |
</models>
|
27 |
<farapp_connector module="farapp_connector">
|
28 |
<import_entities>
|
9 |
<config>
|
10 |
<modules>
|
11 |
<FarApp_Connector>
|
12 |
+
<version>1.2.9</version>
|
13 |
</FarApp_Connector>
|
14 |
</modules>
|
15 |
<global>
|
23 |
<order_creditmemo_api>FarApp_Connector_Model_Order_Creditmemo_Api</order_creditmemo_api>
|
24 |
</rewrite>
|
25 |
</sales>
|
26 |
+
<catalog>
|
27 |
+
<rewrite>
|
28 |
+
<product_api>FarApp_Connector_Model_Product_Api</product_api>
|
29 |
+
</rewrite>
|
30 |
+
</catalog>
|
31 |
</models>
|
32 |
<farapp_connector module="farapp_connector">
|
33 |
<import_entities>
|
app/code/community/FarApp/Connector/etc/wsdl.xml
CHANGED
@@ -8,6 +8,20 @@
|
|
8 |
<part name="invoiceIncrementId" type="xsd:string" />
|
9 |
<part name="offline" type="xsd:boolean" />
|
10 |
</message>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
<service name="{{var wsdl.name}}Service">
|
13 |
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
|
8 |
<part name="invoiceIncrementId" type="xsd:string" />
|
9 |
<part name="offline" type="xsd:boolean" />
|
10 |
</message>
|
11 |
+
<message name="catalogProductListRequest">
|
12 |
+
<part name="sessionId" type="xsd:string"/>
|
13 |
+
<part name="filters" type="typens:filters"/>
|
14 |
+
<part name="storeView" type="xsd:string"/>
|
15 |
+
<part name="detailed" type="xsd:boolean"/>
|
16 |
+
</message>
|
17 |
+
<message name="catalogProductInfoRequest">
|
18 |
+
<part name="sessionId" type="xsd:string"/>
|
19 |
+
<part name="productId" type="xsd:string"/>
|
20 |
+
<part name="storeView" type="xsd:string"/>
|
21 |
+
<part name="attributes" type="typens:catalogProductRequestAttributes"/>
|
22 |
+
<part name="identifierType" type="xsd:string"/>
|
23 |
+
<part name="detailed" type="xsd:boolean"/>
|
24 |
+
</message>
|
25 |
|
26 |
<service name="{{var wsdl.name}}Service">
|
27 |
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>FarApp_Connector</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://www.farapp.com/signup/">Commercial</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Connector to sync product data from FarApp to Magento. FarApp currently supports NetSuite and other backends.</summary>
|
10 |
<description>FarApp is a cloud-based solution for posting product data to storefronts, retrieving orders from storefront and posting fulfillments to storefronts. We support various backends including NetSuite, X-Cart, 3D-Cart, and more. This connector allows full product data posting to Magento from FarApp. It has the the extra benefits of allowing FarApp to dynamically push new product data, automatically creating new attribute options and importing external images (features not provided by Magento).</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>FarApp</name><user>FarApp</user><email>support@farapp.com</email></author></authors>
|
13 |
-
<date>2016-01-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="FarApp"><dir name="Connector"><dir name="Model"><dir name="Export"><dir name="Adapter"><file name="Abstract.php" hash="765dc8fbab996f17b9f049cc8aa906a0"/><file name="Array.php" hash="6ca62c702dcb9512ec429563ac1ce1a2"/></dir><dir name="Entity"><file name="Order.php" hash="14a2f735cf8fc5e8f2bcd6682a1e56b1"/></dir></dir><file name="Export.php" hash="01643ef101731c6d98bbc523642f95a0"/><dir name="Import"><dir name="Entity"><file name="Customer.php" hash="376978f635c73605d428037cca8cf594"/><file name="Order.php" hash="38579396825a1bd3ad59de84278085f6"/><file name="Product.php" hash="212ce858d898edb59445e0925f8a79b3"/><file name="minVersion2.php" hash="8df670fd68516ba1629304ae8ab6c812"/></dir></dir><file name="Import.php" hash="5f226d5505bf8e258a4e61f43b09b25a"/><dir name="Order"><dir name="Creditmemo"><file name="Api.php" hash="edb85d34679eab92e8990a0dd065632e"/></dir><dir name="Invoice"><file name="Api.php" hash="f133255dae51ab9c44c71ca9cc702d0a"/></dir></dir></dir><dir name="controllers"><file name="ExportController.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.0.0</min><max>5.7.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>FarApp_Connector</name>
|
4 |
+
<version>1.2.9</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://www.farapp.com/signup/">Commercial</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Connector to sync product data from FarApp to Magento. FarApp currently supports NetSuite and other backends.</summary>
|
10 |
<description>FarApp is a cloud-based solution for posting product data to storefronts, retrieving orders from storefront and posting fulfillments to storefronts. We support various backends including NetSuite, X-Cart, 3D-Cart, and more. This connector allows full product data posting to Magento from FarApp. It has the the extra benefits of allowing FarApp to dynamically push new product data, automatically creating new attribute options and importing external images (features not provided by Magento).</description>
|
11 |
+
<notes>Added more details product retrieval API methods.</notes>
|
12 |
<authors><author><name>FarApp</name><user>FarApp</user><email>support@farapp.com</email></author></authors>
|
13 |
+
<date>2016-01-22</date>
|
14 |
+
<time>00:54:36</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="FarApp"><dir name="Connector"><dir name="Model"><dir name="Export"><dir name="Adapter"><file name="Abstract.php" hash="765dc8fbab996f17b9f049cc8aa906a0"/><file name="Array.php" hash="6ca62c702dcb9512ec429563ac1ce1a2"/></dir><dir name="Entity"><file name="Order.php" hash="14a2f735cf8fc5e8f2bcd6682a1e56b1"/></dir></dir><file name="Export.php" hash="01643ef101731c6d98bbc523642f95a0"/><dir name="Import"><dir name="Entity"><file name="Customer.php" hash="376978f635c73605d428037cca8cf594"/><file name="Order.php" hash="38579396825a1bd3ad59de84278085f6"/><file name="Product.php" hash="212ce858d898edb59445e0925f8a79b3"/><file name="minVersion2.php" hash="8df670fd68516ba1629304ae8ab6c812"/></dir></dir><file name="Import.php" hash="5f226d5505bf8e258a4e61f43b09b25a"/><dir name="Order"><dir name="Creditmemo"><file name="Api.php" hash="edb85d34679eab92e8990a0dd065632e"/></dir><dir name="Invoice"><file name="Api.php" hash="f133255dae51ab9c44c71ca9cc702d0a"/></dir></dir><dir name="Product"><file name="Api.php" hash="3008de0e51845a38fe59a99b6e276aab"/></dir></dir><dir name="controllers"><file name="ExportController.php" hash="83a48feea4dc3d601b2cef7df2d27110"/><file name="ImportController.php" hash="ec66abaf46073b9491889a199d665992"/><file name="IndexController.php" hash="93918848d3ce7f6ad05688f89a730e75"/></dir><dir name="etc"><file name="api.xml" hash="6178269d7dc6cb7aa1188f059e75a4fc"/><file name="config.xml" hash="dbe1b1825344ab900cdd56d1b3c58011"/><file name="wsdl.xml" hash="53aac63b4e1503137d9280b374d51b03"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FarApp_Connector.xml" hash="ff3fe315c70239229cb5ff3a49d40967"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.0.0</min><max>5.7.0</max></php></required></dependencies>
|
18 |
</package>
|