Version Notes
Added an update for modifying pricing when updating inventories through the REST API.
Download this release
Release Info
Developer | nChannel |
Extension | nChannel_Communicator |
Version | 0.2.1 |
Comparing to | |
See all releases |
Code changes from version 0.1.12 to 0.2.1
- app/code/community/Nchannel/Communicator/Model/Api2/Renderer/Json.php +30 -0
- app/code/community/Nchannel/Communicator/Model/Api2/Stock/Item/Rest/Admin/V1.php +135 -0
- app/code/community/Nchannel/Communicator/Model/Helloworld/Api.php +0 -9
- app/code/community/Nchannel/Communicator/Model/Helloworld/Api/V2.php +0 -41
- app/code/community/Nchannel/Communicator/Model/Observer.php +118 -92
- app/code/community/Nchannel/Communicator/Model/Productutility/Api/V2.php +137 -59
- app/code/community/Nchannel/Communicator/Model/Source/NchannelEnvironment.php +1 -0
- app/code/community/Nchannel/Communicator/Model/Source/NchannelOrderStatus.php +20 -0
- app/code/community/Nchannel/Communicator/etc/api.xml +9 -0
- app/code/community/Nchannel/Communicator/etc/api2.xml +42 -0
- app/code/community/Nchannel/Communicator/etc/system.xml +23 -1
- app/code/community/Nchannel/Communicator/etc/wsdl.xml +79 -0
- package.xml +5 -5
app/code/community/Nchannel/Communicator/Model/Api2/Renderer/Json.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nchannel_Communicator_Model_Api2_ Renderer_Json implements Mage_Api2_Model_Renderer_Json
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Adapter mime type
|
7 |
+
*/
|
8 |
+
const MIME_TYPE = 'application/json';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Convert Array to JSON
|
12 |
+
*
|
13 |
+
* @param array|object $data
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function render($data)
|
17 |
+
{
|
18 |
+
return Zend_Json::encode($data);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get MIME type generated by renderer
|
23 |
+
*
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getMimeType()
|
27 |
+
{
|
28 |
+
return self::MIME_TYPE;
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Nchannel/Communicator/Model/Api2/Stock/Item/Rest/Admin/V1.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nchannel_Communicator_Model_Api2_Stock_Item_Rest_Admin_V1 extends Mage_CatalogInventory_Model_Api2_Stock_Item
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Load stock item by id
|
7 |
+
*
|
8 |
+
* @param string $sku
|
9 |
+
* @throws Mage_Api2_Exception
|
10 |
+
* @return Mage_CatalogInventory_Model_Stock_Item
|
11 |
+
*/
|
12 |
+
protected function _update(array $data)
|
13 |
+
{
|
14 |
+
/* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
|
15 |
+
|
16 |
+
$productId = Mage::getModel('catalog/product')->getIdBySku($data['sku']);
|
17 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
|
18 |
+
|
19 |
+
|
20 |
+
/* @var $validator Mage_CatalogInventory_Model_Api2_Stock_Item_Validator_Item */
|
21 |
+
$validator = Mage::getModel('cataloginventory/api2_stock_item_validator_item', array(
|
22 |
+
'resource' => $this
|
23 |
+
));
|
24 |
+
|
25 |
+
if (!$validator->isValidData($data)) {
|
26 |
+
foreach ($validator->getErrors() as $error) {
|
27 |
+
$this->_error($error, Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
|
28 |
+
}
|
29 |
+
$this->_critical(self::RESOURCE_DATA_PRE_VALIDATION_ERROR);
|
30 |
+
}
|
31 |
+
|
32 |
+
// Quantity
|
33 |
+
if ($data['qty'] != null && $data['qty'] != '')
|
34 |
+
{
|
35 |
+
$stockItem->setData('qty', $data['qty']);
|
36 |
+
Mage::log('Qty: '.$data['qty'],null,'nChannel_Communicator.log');
|
37 |
+
}
|
38 |
+
|
39 |
+
// Reorder Point
|
40 |
+
if ($data['notify_stock_qty'] != null && $data['notify_stock_qty'] != '')
|
41 |
+
{
|
42 |
+
$stockItem->setData('notify_stock_qty', $data['notify_stock_qty']);
|
43 |
+
Mage::log('Notify_Stock_Qty: '.$data['notify_stock_qty'],null,'nChannel_Communicator.log');
|
44 |
+
}
|
45 |
+
|
46 |
+
// Restock Level
|
47 |
+
if ($data['min_qty'] != null && $data['min_qty'] != '')
|
48 |
+
{
|
49 |
+
$stockItem->setData('min_qty', $data['min_qty']);
|
50 |
+
Mage::log('Min_Qty: '.$data['min_qty'],null,'nChannel_Communicator.log');
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($data['price'] != null && $data['price'] != '')
|
54 |
+
{
|
55 |
+
//$product->setPrice($data['price']);
|
56 |
+
Mage::getSingleton('catalog/product_action')
|
57 |
+
->updateAttributes(array($productId), array('price' => $data['price']), 0);
|
58 |
+
Mage::log('Price: '.$data['price'],null,'nChannel_Communicator.log');
|
59 |
+
}
|
60 |
+
|
61 |
+
try {
|
62 |
+
$stockItem->save();
|
63 |
+
} catch (Mage_Core_Exception $e) {
|
64 |
+
Mage::log($e->getMessage(),null,'nChannel_Communicator.log');
|
65 |
+
$this->_error($e->getMessage(), Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR);
|
66 |
+
} catch (Exception $e) {
|
67 |
+
Mage::log($e->getMessage(),null,'nChannel_Communicator.log');
|
68 |
+
$this->_critical(self::RESOURCE_INTERNAL_ERROR);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function _multiUpdate(array $data)
|
73 |
+
{
|
74 |
+
foreach ($data as $itemData) {
|
75 |
+
try {
|
76 |
+
if (!is_array($itemData)) {
|
77 |
+
$this->_errorMessage(self::RESOURCE_DATA_INVALID, Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
|
78 |
+
$this->_critical(self::RESOURCE_DATA_PRE_VALIDATION_ERROR);
|
79 |
+
}
|
80 |
+
|
81 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $itemData['sku']);
|
82 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
83 |
+
|
84 |
+
unset($itemData['item_id']); // item_id is not for update
|
85 |
+
|
86 |
+
// Quantity
|
87 |
+
if ($itemData['qty'] != null && $itemData['qty'] != '')
|
88 |
+
{
|
89 |
+
$stockItem->setData('qty', $itemData['qty']);
|
90 |
+
Mage::log($itemData['qty'],null,'nChannel_Communicator.log');
|
91 |
+
}
|
92 |
+
|
93 |
+
// Reorder Point
|
94 |
+
if ($itemData['notify_stock_qty'] != null && $itemData['notify_stock_qty'] != '')
|
95 |
+
{
|
96 |
+
$stockItem->setData('notify_stock_qty', $itemData['notify_stock_qty']);
|
97 |
+
Mage::log($itemData['notify_stock_qty'],null,'nChannel_Communicator.log');
|
98 |
+
}
|
99 |
+
|
100 |
+
// Restock Level
|
101 |
+
if ($itemData['min_qty'] != null && $itemData['min_qty'] != '')
|
102 |
+
{
|
103 |
+
$stockItem->setData('min_qty', $itemData['min_qty']);
|
104 |
+
Mage::log($itemData['min_qty'],null,'nChannel_Communicator.log');
|
105 |
+
}
|
106 |
+
|
107 |
+
$stockItem->save();
|
108 |
+
|
109 |
+
$this->_successMessage(self::RESOURCE_UPDATED_SUCCESSFUL, Mage_Api2_Model_Server::HTTP_OK, array(
|
110 |
+
'item_id' => $stockItem->getId()
|
111 |
+
));
|
112 |
+
} catch (Mage_Api2_Exception $e) {
|
113 |
+
// pre-validation errors are already added
|
114 |
+
if ($e->getMessage() != self::RESOURCE_DATA_PRE_VALIDATION_ERROR) {
|
115 |
+
$this->_errorMessage($e->getMessage(), $e->getCode(), array(
|
116 |
+
'item_id' => isset($itemData['item_id']) ? $itemData['item_id'] : null
|
117 |
+
));
|
118 |
+
}
|
119 |
+
} catch (Exception $e) {
|
120 |
+
$this->_errorMessage(
|
121 |
+
Mage_Api2_Model_Resource::RESOURCE_INTERNAL_ERROR,
|
122 |
+
Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR,
|
123 |
+
array(
|
124 |
+
'item_id' => isset($itemData['item_id']) ? $itemData['item_id'] : null
|
125 |
+
)
|
126 |
+
);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
protected function _retrieve()
|
132 |
+
{
|
133 |
+
return 'retrieve';
|
134 |
+
}
|
135 |
+
}
|
app/code/community/Nchannel/Communicator/Model/Helloworld/Api.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Nchannel_Communicator_Model_Helloworld_Api extends Mage_Api_Model_Resource_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function hello($msg) {
|
7 |
-
return "My Custom HelloWorld API In Magento. Here is Your Message ". $msg ;
|
8 |
-
}
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Nchannel/Communicator/Model/Helloworld/Api/V2.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Nchannel_Communicator_Model_Helloworld_Api_V2 extends Nchannel_Communicator_Model_Helloworld_Api
|
4 |
-
{
|
5 |
-
|
6 |
-
public function hello($msg) {
|
7 |
-
$rtnString = "";
|
8 |
-
$attributes = Mage::getSingleton('eav/config')
|
9 |
-
->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
|
10 |
-
|
11 |
-
$attributes->addStoreLabel(Mage::app()->getStore()->getId());
|
12 |
-
|
13 |
-
// Loop over all attributes
|
14 |
-
foreach ($attributes as $attr) {
|
15 |
-
/* @var $attr Mage_Eav_Model_Entity_Attribute */
|
16 |
-
// get the store label value
|
17 |
-
$label = $attr->getStoreLabel() ? $attr->getStoreLabel() : $attr->getFrontendLabel();
|
18 |
-
$rtnString = $rtnString . "Attribute: {$label}\n";
|
19 |
-
|
20 |
-
// If it is an attribute with predefined values
|
21 |
-
if ($attr->usesSource()) {
|
22 |
-
|
23 |
-
// Get all option values ans labels
|
24 |
-
$options = $attr->getSource()->getAllOptions();
|
25 |
-
|
26 |
-
// Output all option labels and values
|
27 |
-
foreach ($options as $option)
|
28 |
-
{
|
29 |
-
$rtnString = $rtnString . " {$option['label']} (Value {$option['value']})\n";
|
30 |
-
}
|
31 |
-
}
|
32 |
-
else
|
33 |
-
{
|
34 |
-
// Just for clarification of the debug code
|
35 |
-
$rtnString = $rtnString . " No select or multiselect attribute\n";
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
return $rtnString;
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Nchannel/Communicator/Model/Observer.php
CHANGED
@@ -8,29 +8,48 @@ class Nchannel_Communicator_Model_Observer
|
|
8 |
*/
|
9 |
public function orderSaved(Varien_Event_Observer $observer)
|
10 |
{
|
11 |
-
Mage::
|
12 |
$order = $observer->getEvent()->getOrder();
|
13 |
$origData = $order->getOrigData();
|
14 |
-
Mage::log("
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
if(($order->getStatus() ==
|
19 |
{
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
Mage::log("Order will not be sent to nChannel",null,'nChannel_Communicator.log');
|
26 |
-
}
|
27 |
-
|
28 |
}
|
29 |
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
{
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
|
|
34 |
public function sendToAPI(Varien_Event_Observer $observer)
|
35 |
{
|
36 |
// Retrieve the product being updated from the event observer
|
@@ -41,90 +60,97 @@ class Nchannel_Communicator_Model_Observer
|
|
41 |
{
|
42 |
$order = $observer->getEvent()->getOrder();
|
43 |
$origData = $order->getOrigData();
|
|
|
|
|
44 |
Mage::log("Order: " . $order->getIncrementId() . " Status: " . $order->getStatus(),null,'nChannel_Communicator.log');
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
//Mage::log('Error in sending Order to nChannel',null,'nChannel_Communicator.log');
|
92 |
-
$info = curl_getinfo($ch);
|
93 |
-
Mage::log('Status Code: ' . $info['http_code'],null,'nChannel_Communicator.log');
|
94 |
-
if($info['http_code'] != '200')
|
95 |
{
|
96 |
-
Mage::log('
|
97 |
-
$
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
$
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
-
|
117 |
-
|
|
|
118 |
|
119 |
-
|
|
|
120 |
}
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
}catch(HttpException $ex){
|
126 |
-
Mage::log("There was an error with communicating with nChannel API. error: " . $ex,null,'nChannel_Communicator.log');
|
127 |
}
|
|
|
128 |
}else{
|
129 |
Mage::log("nChannel Communicator is disabled: {$enabled}", null, 'nChannel_Communicator.log');
|
130 |
}
|
8 |
*/
|
9 |
public function orderSaved(Varien_Event_Observer $observer)
|
10 |
{
|
11 |
+
$statusConfig = Mage::getStoreConfig('Communicator/Orders/SENDONSTATUS');
|
12 |
$order = $observer->getEvent()->getOrder();
|
13 |
$origData = $order->getOrigData();
|
14 |
+
Mage::log("Status Configuration: " . $statusConfig,null,'nChannel_Communicator.log');
|
15 |
+
|
16 |
+
// Check the configuration options for the status to send orders down. "All" sends every order regardless.
|
17 |
+
// "On Hold" orders are also processed based on this configuration option.
|
18 |
+
if (($order->getStatus() == $statusConfig || $statusConfig == 'all') && $origData['status'] != "holded")
|
19 |
{
|
20 |
+
Mage::log("Order: " . $order->getIncrementId() . " Status: " . $order->getStatus(),null,'nChannel_Communicator.log');
|
21 |
+
Mage::log("is object new" . $order->isObjectNew(),null,'nChannel_Communicator.log');
|
22 |
+
Mage::log("status: " . $order->getStatus(),null,'nChannel_Communicator.log');
|
23 |
+
Mage::log("Order will be sent to nChannel",null,'nChannel_Communicator.log');
|
24 |
+
$this->sendToAPI($observer);
|
|
|
|
|
|
|
25 |
}
|
26 |
else
|
27 |
+
{
|
28 |
+
Mage::log("orderSaved",null,'nChannel_Communicator.log');
|
29 |
+
$order = $observer->getEvent()->getOrder();
|
30 |
+
$origData = $order->getOrigData();
|
31 |
+
Mage::log("Order: " . $order->getIncrementId() . " Status: " . $order->getStatus(),null,'nChannel_Communicator.log');
|
32 |
+
Mage::log("is object new" . $order->isObjectNew(),null,'nChannel_Communicator.log');
|
33 |
+
Mage::log("status: " . $order->getStatus(),null,'nChannel_Communicator.log');
|
34 |
+
Mage::log("old status: " . $origData['status'],null,'nChannel_Communicator.log');
|
35 |
+
if((($statusConfig == "pending" || $statusConfig == "processing") && ($order->getStatus() == $statusConfig || $order->getStatus() == 'all')) && $origData)
|
36 |
{
|
37 |
+
if($origData['status'] == "holded")
|
38 |
+
{
|
39 |
+
Mage::log("Order will be sent to nChannel",null,'nChannel_Communicator.log');
|
40 |
+
$this->sendToAPI($observer);
|
41 |
+
}else{
|
42 |
+
Mage::log("Order will not be sent to nChannel",null,'nChannel_Communicator.log');
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
else
|
47 |
+
{
|
48 |
+
Mage::log("New Order will not be sent to nChannel.",null,'nChannel_Communicator.log');
|
49 |
+
}
|
50 |
+
}
|
51 |
}
|
52 |
+
|
53 |
public function sendToAPI(Varien_Event_Observer $observer)
|
54 |
{
|
55 |
// Retrieve the product being updated from the event observer
|
60 |
{
|
61 |
$order = $observer->getEvent()->getOrder();
|
62 |
$origData = $order->getOrigData();
|
63 |
+
$statusConfig = Mage::getStoreConfig('Communicator/Orders/SENDONSTATUS');
|
64 |
+
Mage::log("Status Configuration: " . $statusConfig,null,'nChannel_Communicator.log');
|
65 |
Mage::log("Order: " . $order->getIncrementId() . " Status: " . $order->getStatus(),null,'nChannel_Communicator.log');
|
66 |
|
67 |
+
if ($order->getStatus() == $statusConfig || $statusConfig == 'all')
|
68 |
+
{
|
69 |
+
Mage::log("Processing order to send to nChannel.",null,'nChannel_Communicator.log');
|
70 |
+
$token = Mage::getStoreConfig('Communicator/Credentials/TOKEN');
|
71 |
+
$locationID = Mage::getStoreConfig('Communicator/Credentials/LOCATION');
|
72 |
+
$now = new DateTime;
|
73 |
+
$time = gettimeofday();
|
74 |
+
// Write a new line to var/log/product-updates.log
|
75 |
+
$orderID = $order->getIncrementId();
|
76 |
+
$orderXML = "<EventNotification><EventDate>{$now->format('m-d-Y')}</EventDate><EventTime>{$now->format('h:i:s A')}</EventTime><EventSite></EventSite><Event>NewOrder</Event><EventData><OrderNumber>$orderID</OrderNumber></EventData></EventNotification>";
|
77 |
+
Mage::log("Order: # {$orderID} created, enabled: {$enabled}", null, 'nChannel_Communicator.log');
|
78 |
+
Mage::log("Outbound XML = {$orderXML}", null, 'nChannel_Communicator.log');
|
79 |
+
//Create config for URL -> Production/Dev/Local
|
80 |
+
// send XML to api
|
81 |
+
$url = Mage::getStoreConfig('Communicator/Credentials/URL');
|
82 |
+
|
83 |
+
$url.= $locationID . "?token=" . $token;
|
84 |
+
Mage::log("Sending XML to nChannel API url: " . $url, null, 'nChannel_Communicator.log');
|
85 |
+
//$r = new HttpRequest($url, HttpRequest::METH_POST);
|
86 |
+
//$r->setContentType("text/xml charset=utf-8");
|
87 |
+
//$r->addRawPostData($orderXML);
|
88 |
+
Mage::log("Prepared HttpRequest",null,'nChannel_Communicator.log');
|
89 |
+
|
90 |
+
try{
|
91 |
+
Mage::log("sending",null,'nChannel_Communicator.log');
|
92 |
+
if (in_array ('curl', get_loaded_extensions())) {
|
93 |
+
Mage::log("curl loaded",null,'nChannel_Communicator.log');
|
94 |
+
}
|
95 |
+
else{
|
96 |
+
Mage::log("curl is not loaded",null,'nChannel_Communicator.log');
|
97 |
+
}
|
98 |
+
$ch = curl_init($url);
|
99 |
+
//curl_setopt($ch, CURLOPT_MUTE, 1);
|
100 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
101 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
102 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
103 |
+
//curl_setopt($ch, CURLOPT_HEADER,1);//Include Header In Output
|
104 |
+
//curl_setopt($ch, CURLOPT_NOBODY,1);//Set to HEAD & Exclude body
|
105 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
|
106 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, "$orderXML");
|
107 |
+
//curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
108 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
109 |
+
Mage::log('sending it now',null,'nChannel_Communicator.log');
|
110 |
+
$output = curl_exec($ch);
|
111 |
+
if(!curl_errno($ch))
|
|
|
|
|
|
|
|
|
112 |
{
|
113 |
+
//Mage::log('Error in sending Order to nChannel',null,'nChannel_Communicator.log');
|
114 |
+
$info = curl_getinfo($ch);
|
115 |
+
Mage::log('Status Code: ' . $info['http_code'],null,'nChannel_Communicator.log');
|
116 |
+
if($info['http_code'] != '200')
|
117 |
+
{
|
118 |
+
Mage::log('Sending Email to nChannel Support',null,'nChannel_Communicator.log');
|
119 |
+
$templateId = Mage::getStoreConfig('Communicator/Support/EMAILTEMPLATE');
|
120 |
+
$mailSubject = Mage::getStoreConfig('Communicator/Support/SUBJECT');
|
121 |
+
//$email = Mage::getStoreConfig('Communicator/Support/EMAILTO');
|
122 |
+
$name = Mage::getStoreConfig('Communicator/Support/EMAILTO');
|
123 |
+
$storeId = Mage::app()->getStore()->getId();
|
124 |
+
$sender = Array('name' => Mage::getStoreConfig('Communicator/Support/EMAILSENDER'),
|
125 |
+
'email' => Mage::getStoreConfig('Communicator/Support/EMAILSENDER'));
|
126 |
+
$vars = Array('order' => $order,'payment_html' => $order->getPayment()->getMethodInstance()->getTitle());
|
127 |
+
|
128 |
+
$recipients = explode(",",Mage::getStoreConfig('Communicator/Support/EMAILTO'));
|
129 |
+
foreach($recipients as $recipient){
|
130 |
+
$translate = Mage::getSingleton('core/translate');
|
131 |
+
Mage::getModel('core/email_template')
|
132 |
+
->setTemplateSubject($mailSubject)
|
133 |
+
->sendTransactional($templateId, $sender, $recipient, $name, $vars, $storeId);
|
134 |
+
$translate->setTranslateInline(true);
|
135 |
+
}
|
136 |
|
137 |
+
}
|
138 |
+
}else
|
139 |
+
{
|
140 |
+
|
141 |
+
Mage::log("Order sent to nChannel",null,'nChannel_Communicator.log');
|
142 |
}
|
143 |
+
curl_close($ch);
|
144 |
+
|
145 |
+
|
146 |
|
147 |
+
}catch(HttpException $ex){
|
148 |
+
Mage::log("There was an error with communicating with nChannel API. error: " . $ex,null,'nChannel_Communicator.log');
|
149 |
}
|
150 |
+
}else{
|
151 |
+
Mage::log("Order will not be sent to nChannel.", null, 'nChannel_Communicator.log');
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
+
|
154 |
}else{
|
155 |
Mage::log("nChannel Communicator is disabled: {$enabled}", null, 'nChannel_Communicator.log');
|
156 |
}
|
app/code/community/Nchannel/Communicator/Model/Productutility/Api/V2.php
CHANGED
@@ -1,48 +1,47 @@
|
|
1 |
<?php
|
2 |
class Nchannel_Communicator_Model_Productutility_Api_V2 extends Nchannel_Communicator_Model_Productutility_Api
|
3 |
{
|
4 |
-
public function linkConfigurable($configurableProductID)
|
5 |
-
{
|
6 |
-
Mage::log("LinkConfigurable fired!" . $url, null, 'nChannel_Communicator.log');
|
7 |
-
return "Hello World! My argument is : " . $configurableProductID;
|
8 |
-
}
|
9 |
public function attachProductToConfigurable( $childSku, $configurableProductID ) {
|
10 |
-
Mage::log('attachProductToConfigurable: sku ' . $childSku,null,'nChannel_Communicator.log');
|
11 |
-
Mage::log('attachProductToConfigurable: pid ' . $configurableProductID,null,'nChannel_Communicator.log');
|
12 |
-
$model = Mage::getModel('catalog/product');
|
13 |
-
$configurableProduct = $model->load($configurableProductID);
|
14 |
-
Mage::log('attachProductToConfigurable: Configurable Product ID: ' . print_r($configurableProduct->getId(),true),null, 'nChannel_Communicator.log');
|
15 |
-
$newModel = Mage::getModel('catalog/product');
|
16 |
-
$loader = Mage::getResourceModel( 'catalog/product_type_configurable' )->load($newModel,$configurableProductID);
|
17 |
-
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$childSku);
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
Mage::log('attachProductToConfigurable: existing id output: ' . $id,null,'nChannel_Communicator.log');
|
28 |
-
$newids[$id] = 1;
|
29 |
-
}
|
30 |
-
}
|
31 |
-
$newids[$product->getId()] = 1;
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
public function detachProductFromConfigurable( $childSku, $configurableProductID ) {
|
@@ -95,26 +94,6 @@ class Nchannel_Communicator_Model_Productutility_Api_V2 extends Nchannel_Communi
|
|
95 |
|
96 |
public function addAttributes($sku , $configAttrCodes)
|
97 |
{
|
98 |
-
/*$product = new Mage_Catalog_Model_Product();
|
99 |
-
$product->setSku($sku);
|
100 |
-
$product->setAttributeSetId('9');
|
101 |
-
$product->setTaxClassId(0);
|
102 |
-
$product->setStatus(1);
|
103 |
-
$product->setTypeID('configurable');
|
104 |
-
$product->setWebsiteIds(array(1));
|
105 |
-
$product->setName('testing1234');
|
106 |
-
$product->setDescription('desc');
|
107 |
-
$product->setShortDescription('short');
|
108 |
-
$product->setPrice('9.99');
|
109 |
-
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
110 |
-
try {
|
111 |
-
$product->save();
|
112 |
-
Mage::log("Saved",null,'nChannel_Communicator.log');
|
113 |
-
}
|
114 |
-
catch (Exception $e){
|
115 |
-
Mage::log("exception:$e",null,'nChannel_Communicator.log');
|
116 |
-
}*/
|
117 |
-
|
118 |
Mage::log("Created Product",null,'nChannel_Communicator.log');
|
119 |
$configProduct = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
|
120 |
|
@@ -159,6 +138,22 @@ class Nchannel_Communicator_Model_Productutility_Api_V2 extends Nchannel_Communi
|
|
159 |
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
public function loadSimpleProductsFromConfigurable($configurableProductSKU)
|
163 |
{
|
164 |
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $configurableProductSKU);
|
@@ -194,5 +189,88 @@ class Nchannel_Communicator_Model_Productutility_Api_V2 extends Nchannel_Communi
|
|
194 |
|
195 |
return $result;
|
196 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
?>
|
1 |
<?php
|
2 |
class Nchannel_Communicator_Model_Productutility_Api_V2 extends Nchannel_Communicator_Model_Productutility_Api
|
3 |
{
|
|
|
|
|
|
|
|
|
|
|
4 |
public function attachProductToConfigurable( $childSku, $configurableProductID ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
Mage::log('attachProductToConfigurable: sku ' . $childSku, null, 'nChannel_Communicator.log');
|
7 |
+
Mage::log('attachProductToConfigurable: pid ' . $configurableProductID, null, 'nChannel_Communicator.log');
|
8 |
+
$model = Mage::getModel('catalog/product');
|
9 |
+
$configurableProduct = $model->load($configurableProductID);
|
10 |
+
Mage::log('attachProductToConfigurable: Configurable Product ID: ' . print_r($configurableProduct->getId(), true), null, 'nChannel_Communicator.log');
|
11 |
+
$newModel = Mage::getModel('catalog/product');
|
12 |
+
$loader = Mage::getResourceModel('catalog/product_type_configurable')->load($newModel, $configurableProductID);
|
13 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $childSku);
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
$ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($configurableProductID);
|
16 |
+
$newids = array();
|
17 |
+
Mage::log('attachProductToConfigurable: current child product id output: ' . $product->getId(), null, 'nChannel_Communicator.log');
|
18 |
+
|
19 |
+
Mage::log('attachProductToConfigurable: Loop existing IDs', null, 'nChannel_Communicator.log');
|
20 |
+
foreach ($ids as $arr) {
|
21 |
+
foreach ($arr as $id) {
|
22 |
+
Mage::log('attachProductToConfigurable: existing id output: ' . $id, null, 'nChannel_Communicator.log');
|
23 |
+
$newids[$id] = 1;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
$newids[$product->getId()] = 1;
|
27 |
+
try {
|
28 |
+
try {
|
29 |
+
Mage::log('attachProductToConfigurable: Saving Products', null, 'nChannel_Communicator.log');
|
30 |
+
Mage::log('attachProductToConfigurable: Configurable Product ID: ' . print_r($configurableProduct->getId(), true), null, 'nChannel_Communicator.log');
|
31 |
+
$loader->saveProducts($configurableProduct, array_keys($newids));
|
32 |
+
} catch (exception $ex) {
|
33 |
+
array_pop($newids);
|
34 |
+
$loader->saveProducts($test, array_keys($newids));
|
35 |
+
Mage::log('attachProductToConfigurable: erorr ->' . $ex->getMessage(), null, 'nChannel_Communicator.log');
|
36 |
+
}
|
37 |
+
Mage::log('attachProductToConfigurable: Product ' . $childSku . ' was added', null, 'nChannel_Communicator.log');
|
38 |
+
Mage::log('attachProductToConfigurable: Complete', null, 'nChannel_Communicator.log');
|
39 |
+
return "Success!";
|
40 |
+
}
|
41 |
+
catch (exception $ex)
|
42 |
+
{
|
43 |
+
Mage::log('attachProductToConfigurable: error =->' . $ex->getMessage(), null, 'nChannel_Communicator.log');
|
44 |
+
}
|
45 |
}
|
46 |
|
47 |
public function detachProductFromConfigurable( $childSku, $configurableProductID ) {
|
94 |
|
95 |
public function addAttributes($sku , $configAttrCodes)
|
96 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
Mage::log("Created Product",null,'nChannel_Communicator.log');
|
98 |
$configProduct = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
|
99 |
|
138 |
|
139 |
}
|
140 |
|
141 |
+
public function getConfigurableAttribute($configurableProductSKU)
|
142 |
+
{
|
143 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$configurableProductSKU);
|
144 |
+
$attrs = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
|
145 |
+
Mage::log($attrs[0]['label'],null,'nChannel_Communicator.log');
|
146 |
+
|
147 |
+
return $attrs[0]['label'];
|
148 |
+
// foreach ( $attrs as $attr )
|
149 |
+
// {
|
150 |
+
// Mage::log('id output: ' . $attr['label'],null,'nChannel_Communicator.log');
|
151 |
+
|
152 |
+
// $result[] = $attr['label'];
|
153 |
+
// }
|
154 |
+
// return $result;
|
155 |
+
}
|
156 |
+
|
157 |
public function loadSimpleProductsFromConfigurable($configurableProductSKU)
|
158 |
{
|
159 |
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $configurableProductSKU);
|
189 |
|
190 |
return $result;
|
191 |
}
|
192 |
+
|
193 |
+
public function getCustomerGroups()
|
194 |
+
{
|
195 |
+
$collection = Mage::getModel('customer/group')->getCollection();
|
196 |
+
|
197 |
+
$result = array();
|
198 |
+
foreach ($collection as $group)
|
199 |
+
{
|
200 |
+
$result[] = $group->toArray(array('customer_group_id', 'customer_group_code'));
|
201 |
+
}
|
202 |
+
|
203 |
+
return $result;
|
204 |
+
}
|
205 |
+
|
206 |
+
public function addCustomerGroup($customer)
|
207 |
+
{
|
208 |
+
$collection = Mage::getModel('customer/group')->getCollection()->addFieldToFilter('customer_group_code', $customer);
|
209 |
+
$customerGroup = Mage::getModel('customer/group')->load($collection->getFirstItem()->getId());
|
210 |
+
|
211 |
+
if ($customerGroup != null)
|
212 |
+
{
|
213 |
+
Mage::log('Customer Group Exists. Updating.', null, 'nChannel_Communicator.log');
|
214 |
+
}
|
215 |
+
else
|
216 |
+
{
|
217 |
+
Mage::log('Adding new Customer Group.', null, 'nChannel_Communicator.log');
|
218 |
+
}
|
219 |
+
$customerGroup->setCode($customer);
|
220 |
+
$customerGroup->setTaxClassId(3);
|
221 |
+
$customerGroup->save();
|
222 |
+
|
223 |
+
return $customerGroup['customer_group_id'];
|
224 |
+
}
|
225 |
+
|
226 |
+
public function addGroupPrice($storeView, $customer, $price, $sku)
|
227 |
+
{
|
228 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
|
229 |
+
$customerGroupId = $this->addCustomerGroup($customer);
|
230 |
+
$groupPrices = $product->getData('group_price');
|
231 |
+
|
232 |
+
if (is_null($groupPrices)) {
|
233 |
+
$attribute = $product->getResource()->getAttribute('group_price');
|
234 |
+
if($attribute) {
|
235 |
+
$attribute->getBackend()->afterLoad($product);
|
236 |
+
$groupPrices = $product->getData('group_price');
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
$result = array();
|
241 |
+
$existing = false;
|
242 |
+
|
243 |
+
foreach ($groupPrices as $groupPrice) {
|
244 |
+
$row = array();
|
245 |
+
$row['cust_group'] = (empty($groupPrice['all_groups']) ? $groupPrice['cust_group'] : 'all' );
|
246 |
+
$row['website_id'] = ($groupPrice['website_id'] ?
|
247 |
+
Mage::app()->getWebsite($groupPrice['website_id'])->getId() :
|
248 |
+
'all'
|
249 |
+
);
|
250 |
+
$row['price'] = $groupPrice['price'];
|
251 |
+
|
252 |
+
if ($groupPrice['cust_group'] == $customerGroupId && $groupPrice['website_id'] = $storeView)
|
253 |
+
{
|
254 |
+
$row['price'] = $groupPrice['price'];
|
255 |
+
$existing = true;
|
256 |
+
Mage::log('Found existing Group Price.', null, 'nChannel_Communicator.log');
|
257 |
+
}
|
258 |
+
|
259 |
+
$result[] = $row;
|
260 |
+
}
|
261 |
+
|
262 |
+
if (!$existing)
|
263 |
+
{
|
264 |
+
$row = array(array('cust_group' => $customerGroupId, 'website_id' => (empty($groupPrice['all_groups']) ? $storeView : 'all' ), 'price' => $price));
|
265 |
+
|
266 |
+
$result = array_merge($result, $row);
|
267 |
+
Mage::log('Adding new Group Price.', null, 'nChannel_Communicator.log');
|
268 |
+
}
|
269 |
+
|
270 |
+
$product->setData('group_price', $result);
|
271 |
+
$product->save();
|
272 |
+
|
273 |
+
return $result;
|
274 |
+
}
|
275 |
}
|
276 |
?>
|
app/code/community/Nchannel/Communicator/Model/Source/NchannelEnvironment.php
CHANGED
@@ -12,4 +12,5 @@ class Nchannel_Communicator_Model_Source_NchannelEnvironment
|
|
12 |
);
|
13 |
}
|
14 |
}
|
|
|
15 |
?>
|
12 |
);
|
13 |
}
|
14 |
}
|
15 |
+
|
16 |
?>
|
app/code/community/Nchannel/Communicator/Model/Source/NchannelOrderStatus.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nchannel_Communicator_Model_Source_NchannelOrderStatus
|
4 |
+
{
|
5 |
+
public function toOptionArray($isMultiselect)
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => 'all', 'label' => Mage::helper('Communicator')->__('All')),
|
9 |
+
array('value' => 'pending', 'label' => Mage::helper('Communicator')->__('Pending')),
|
10 |
+
array('value' => 'pending_payment', 'label' => Mage::helper('Communicator')->__('Pending Payment')),
|
11 |
+
array('value' => 'processing', 'label' => Mage::helper('Communicator')->__('Processing')),
|
12 |
+
array('value' => 'holded', 'label' => Mage::helper('Communicator')->__('On Hold')),
|
13 |
+
array('value' => 'complete', 'label' => Mage::helper('Communicator')->__('Complete')),
|
14 |
+
array('value' => 'closed', 'label' => Mage::helper('Communicator')->__('Closed')),
|
15 |
+
array('value' => 'canceled', 'label' => Mage::helper('Communicator')->__('Cancelled')),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
?>
|
app/code/community/Nchannel/Communicator/etc/api.xml
CHANGED
@@ -36,6 +36,15 @@
|
|
36 |
<getConfigurableAttribute translate="title" module="Communicator">
|
37 |
<method>getConfigurableAttribute</method>
|
38 |
</getConfigurableAttribute>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
</methods>
|
40 |
</Communicator_Productutility>
|
41 |
</resources>
|
36 |
<getConfigurableAttribute translate="title" module="Communicator">
|
37 |
<method>getConfigurableAttribute</method>
|
38 |
</getConfigurableAttribute>
|
39 |
+
<verifyCustomerGroup translate="title" module="Communicator">
|
40 |
+
<method>getCustomerGroups</method>
|
41 |
+
</verifyCustomerGroup>
|
42 |
+
<addCustomerGroup translate="title" module="Communicator">
|
43 |
+
<method>addCustomerGroup</method>
|
44 |
+
</addCustomerGroup>
|
45 |
+
<addGroupPrice translate="title" module="Communicator">
|
46 |
+
<method>addGroupPrice</method>
|
47 |
+
</addGroupPrice>
|
48 |
</methods>
|
49 |
</Communicator_Productutility>
|
50 |
</resources>
|
app/code/community/Nchannel/Communicator/etc/api2.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<api2>
|
3 |
+
<resource_groups>
|
4 |
+
<Nchannel_Communicator translate="title" module="Nchannel_Communicator">
|
5 |
+
<title>nChannel API</title>
|
6 |
+
<sort_order>10</sort_order>
|
7 |
+
</Nchannel_Communicator>
|
8 |
+
</resource_groups>
|
9 |
+
<resources>
|
10 |
+
<Nchannel_Communicator translate="title" module="Nchannel_Communicator">
|
11 |
+
<group>Nchannel_Communicator</group>
|
12 |
+
<model>Nchannel_Communicator/api2_stock_item</model>
|
13 |
+
<title>nChannel API</title>
|
14 |
+
<sort_order>10</sort_order>
|
15 |
+
<privileges>
|
16 |
+
<admin>
|
17 |
+
<retrieve>1</retrieve>
|
18 |
+
<update>1</update>
|
19 |
+
</admin>
|
20 |
+
</privileges>
|
21 |
+
<attributes translate="sku qty min_qty notify_stock_qty" module="api2">
|
22 |
+
<sku>SKU</sku>
|
23 |
+
<qty>Qty</qty>
|
24 |
+
<min_qty>Qty for Item's Status to Become Out of Stock</min_qty>
|
25 |
+
<notify_stock_qty>Notify for Quantity Below</notify_stock_qty>
|
26 |
+
<price>Price of the Item</price>
|
27 |
+
</attributes>
|
28 |
+
<routes>
|
29 |
+
<route_entity>
|
30 |
+
<route>/nchannel/stockitem</route>
|
31 |
+
<action_type>entity</action_type>
|
32 |
+
</route_entity>
|
33 |
+
<route_collection>
|
34 |
+
<route>/nchannel/stockitems</route>
|
35 |
+
<action_type>collection</action_type>
|
36 |
+
</route_collection>
|
37 |
+
</routes>
|
38 |
+
<versions>1</versions>
|
39 |
+
</Nchannel_Communicator>
|
40 |
+
</resources>
|
41 |
+
</api2>
|
42 |
+
</config>
|
app/code/community/Nchannel/Communicator/etc/system.xml
CHANGED
@@ -66,7 +66,29 @@
|
|
66 |
</URL>
|
67 |
</fields>
|
68 |
</Credentials>
|
69 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
<label>Support</label>
|
71 |
<frontend_type>text</frontend_type>
|
72 |
<sort_order>200</sort_order>
|
66 |
</URL>
|
67 |
</fields>
|
68 |
</Credentials>
|
69 |
+
<Orders>
|
70 |
+
<label>Orders</label>
|
71 |
+
<frontend_type>text</frontend_type>
|
72 |
+
<sort_order>200</sort_order>
|
73 |
+
<show_in_default>1</show_in_default>
|
74 |
+
<show_in_website>1</show_in_website>
|
75 |
+
<show_in_store>1</show_in_store>
|
76 |
+
<fields>
|
77 |
+
<SENDONSTATUS translate="label">
|
78 |
+
<label>Send Order on Status</label>
|
79 |
+
<comment>
|
80 |
+
<![CDATA[Send only orders with a specific status to nChannel.]]>
|
81 |
+
</comment>
|
82 |
+
<frontend_type>select</frontend_type>
|
83 |
+
<source_model>Nchannel_Communicator/Source_NchannelOrderStatus</source_model>
|
84 |
+
<sort_order>40</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</SENDONSTATUS>
|
89 |
+
</fields>
|
90 |
+
</Orders>
|
91 |
+
<Support>
|
92 |
<label>Support</label>
|
93 |
<frontend_type>text</frontend_type>
|
94 |
<sort_order>200</sort_order>
|
app/code/community/Nchannel/Communicator/etc/wsdl.xml
CHANGED
@@ -6,6 +6,20 @@
|
|
6 |
<types>
|
7 |
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
|
8 |
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
</schema>
|
10 |
</types>
|
11 |
|
@@ -62,6 +76,29 @@
|
|
62 |
<message name="ProductutilityGetConfigurableAttributeResponse">
|
63 |
<part name="result" type="xsd:string" />
|
64 |
</message>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
<portType name="{{var wsdl.handler}}PortType">
|
67 |
<operation name="CommunicatorHello">
|
@@ -98,6 +135,21 @@
|
|
98 |
<documentation>Sets up configurable attributes. </documentation>
|
99 |
<input message="typens:ProductutilityGetConfigurableAttributeRequest" />
|
100 |
<output message="typens:ProductutilityGetConfigurableAttributeResponse" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
</operation>
|
102 |
</portType>
|
103 |
|
@@ -165,6 +217,33 @@
|
|
165 |
<output>
|
166 |
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
167 |
</output>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
</operation>
|
169 |
</binding>
|
170 |
|
6 |
<types>
|
7 |
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
|
8 |
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
|
9 |
+
<complexType name="catalogProductGroupPriceEntity">
|
10 |
+
<all>
|
11 |
+
<element name="cust_group" type="xsd:string" minOccurs="0"/>
|
12 |
+
<element name="website_id" type="xsd:string" minOccurs="0"/>
|
13 |
+
<element name="price" type="xsd:double" minOccurs="0"/>
|
14 |
+
</all>
|
15 |
+
</complexType>
|
16 |
+
<complexType name="catalogProductGroupPriceEntityArray">
|
17 |
+
<complexContent>
|
18 |
+
<restriction base="soapenc:Array">
|
19 |
+
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:catalogProductGroupPriceEntity[]"/>
|
20 |
+
</restriction>
|
21 |
+
</complexContent>
|
22 |
+
</complexType>
|
23 |
</schema>
|
24 |
</types>
|
25 |
|
76 |
<message name="ProductutilityGetConfigurableAttributeResponse">
|
77 |
<part name="result" type="xsd:string" />
|
78 |
</message>
|
79 |
+
<message name="ProductutilityGetCustomerGroupsRequest">
|
80 |
+
<part name="sessionId" type="xsd:string" />
|
81 |
+
</message>
|
82 |
+
<message name="ProductutilityGetCustomerGroupsResponse">
|
83 |
+
<part name="result" type="xsd:string" />
|
84 |
+
</message>
|
85 |
+
<message name="ProductutilityAddCustomerGroupRequest">
|
86 |
+
<part name="sessionId" type="xsd:string" />
|
87 |
+
<part name="customer" type="xsd:string" />
|
88 |
+
</message>
|
89 |
+
<message name="ProductutilityAddCustomerGroupResponse">
|
90 |
+
<part name="result" type="xsd:string" />
|
91 |
+
</message>
|
92 |
+
<message name="ProductutilityAddGroupPriceRequest">
|
93 |
+
<part name="sessionId" type="xsd:string" />
|
94 |
+
<part name="storeView" type="xsd:string" />
|
95 |
+
<part name="customer" type="xsd:string" />
|
96 |
+
<part name="price" type="xsd:double" />
|
97 |
+
<part name="sku" type="xsd:string" />
|
98 |
+
</message>
|
99 |
+
<message name="ProductutilityAddGroupPriceResponse">
|
100 |
+
<part name="result" type="typens:catalogProductGroupPriceEntityArray" />
|
101 |
+
</message>
|
102 |
|
103 |
<portType name="{{var wsdl.handler}}PortType">
|
104 |
<operation name="CommunicatorHello">
|
135 |
<documentation>Sets up configurable attributes. </documentation>
|
136 |
<input message="typens:ProductutilityGetConfigurableAttributeRequest" />
|
137 |
<output message="typens:ProductutilityGetConfigurableAttributeResponse" />
|
138 |
+
</operation>
|
139 |
+
<operation name="ProductutilityGetCustomerGroups">
|
140 |
+
<documentation>Gets Customer Groups. </documentation>
|
141 |
+
<input message="typens:ProductutilityGetCustomerGroupsRequest" />
|
142 |
+
<output message="typens:ProductutilityGetCustomerGroupsResponse" />
|
143 |
+
</operation>
|
144 |
+
<operation name="ProductutilityAddCustomerGroup">
|
145 |
+
<documentation>Adds a Customer Group </documentation>
|
146 |
+
<input message="typens:ProductutilityAddCustomerGroupRequest" />
|
147 |
+
<output message="typens:ProductutilityAddCustomerGroupResponse" />
|
148 |
+
</operation>
|
149 |
+
<operation name="ProductutilityAddGroupPrice">
|
150 |
+
<documentation>Adds a Group Price </documentation>
|
151 |
+
<input message="typens:ProductutilityAddGroupPriceRequest" />
|
152 |
+
<output message="typens:ProductutilityAddGroupPriceResponse" />
|
153 |
</operation>
|
154 |
</portType>
|
155 |
|
217 |
<output>
|
218 |
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
219 |
</output>
|
220 |
+
</operation>
|
221 |
+
<operation name="ProductutilityGetCustomerGroups">
|
222 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
223 |
+
<input>
|
224 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
225 |
+
</input>
|
226 |
+
<output>
|
227 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
228 |
+
</output>
|
229 |
+
</operation>
|
230 |
+
<operation name="ProductutilityAddCustomerGroup">
|
231 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
232 |
+
<input>
|
233 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
234 |
+
</input>
|
235 |
+
<output>
|
236 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
237 |
+
</output>
|
238 |
+
</operation>
|
239 |
+
<operation name="ProductutilityAddGroupPrice">
|
240 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
241 |
+
<input>
|
242 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
243 |
+
</input>
|
244 |
+
<output>
|
245 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
246 |
+
</output>
|
247 |
</operation>
|
248 |
</binding>
|
249 |
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>nChannel_Communicator</name>
|
4 |
-
<version>0.1
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://portal.nchannel.com/Content/data/EULA_2012-04-21.pdf">nChannel EULA</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>nChannel Communicator allows for event driven communication with the nChannel API on creation of new orders.</summary>
|
10 |
<description>nChannel Communicator allows for event driven communication with the nChannel API on creation of new orders.</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>nChannel</name><user>jpepper</user><email>jpepper@nchannel.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Nchannel"><dir name="Communicator"><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="afa8d0feea50602251007002ae1eb4b1"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7d5d9a9593474991cec1d1f521f41482"/></dir><dir name="Model"><file name="Api.php" hash="9001584aa011771215b4a26d31214998"/><dir name="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.5.11</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>nChannel_Communicator</name>
|
4 |
+
<version>0.2.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://portal.nchannel.com/Content/data/EULA_2012-04-21.pdf">nChannel EULA</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>nChannel Communicator allows for event driven communication with the nChannel API on creation of new orders.</summary>
|
10 |
<description>nChannel Communicator allows for event driven communication with the nChannel API on creation of new orders.</description>
|
11 |
+
<notes>Added an update for modifying pricing when updating inventories through the REST API.</notes>
|
12 |
<authors><author><name>nChannel</name><user>jpepper</user><email>jpepper@nchannel.com</email></author></authors>
|
13 |
+
<date>2015-10-14</date>
|
14 |
+
<time>18:46:10</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Nchannel"><dir name="Communicator"><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="afa8d0feea50602251007002ae1eb4b1"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7d5d9a9593474991cec1d1f521f41482"/></dir><dir name="Model"><file name="Api.php" hash="9001584aa011771215b4a26d31214998"/><dir name="Api2"><dir name="Renderer"><file name="Json.php" hash="acd69b838d8787caaf570549084d2cc3"/></dir><dir name="Stock"><dir name="Item"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="e9a15674cd42fe80bb9f3a2321b0cd03"/></dir></dir></dir></dir></dir><file name="Observer.php" hash="13b789b1b2b269779280d995224d320a"/><dir name="Productutility"><dir name="Api"><file name="V2.php" hash="06659b3dae0d7c7926a2e59bce12018c"/></dir><file name="Api.php" hash="83e30c3b4526c851d8ff31dd73957495"/></dir><dir name="Source"><file name="NchannelEnvironment.php" hash="7aac70643c805e246035ac240011ee0b"/><file name="NchannelOrderStatus.php" hash="c10bfe2ed4433a70a2fc5436b267a6f5"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="04f02984743361ad17d0d9c85c05afc5"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1c959ca1b60ae9fc0ea61107c4bf3a8d"/><file name="api.xml" hash="9ec26efdc3de2f9ddb883000962d268c"/><file name="api2.xml" hash="fda700dfa22770de0898a9e8d929bf5a"/><file name="config.xml" hash="11ac8090f0a1b735aa3e92cbca9108bf"/><file name="system.xml" hash="2fcdba2729ff1ce78c08777a38da6c0f"/><file name="wsdl.xml" hash="53112b017d3f6fc2f2ebf65bc5088c9e"/><file name="wsi.xml" hash="41f6baef07d7e977a3fbd26cb37bd5d2"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Nchannel_Communicator.xml" hash="698fe66f544b1bcf42154dcd4d621527"/></dir><dir/></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.5.11</max></php></required></dependencies>
|
18 |
</package>
|