Tritac_ChannelEngine - Version 2.5.0

Version Notes

* Better order import handling

Download this release

Release Info

Developer Christiaan de Ridder
Extension Tritac_ChannelEngine
Version 2.5.0
Comparing to
See all releases


Code changes from version 2.3.6 to 2.5.0

app/code/community/Tritac/ChannelEngine/Model/Observer.php CHANGED
@@ -115,6 +115,12 @@ class Tritac_ChannelEngine_Model_Observer
115
  // Add product to quote
116
  try {
117
  $_quoteItem = $quote->addProduct($_product, $params);
 
 
 
 
 
 
118
  $_quoteItem->setChannelengineOrderLineId($item->getId());
119
 
120
  } catch (Exception $e) {
@@ -270,13 +276,14 @@ class Tritac_ChannelEngine_Model_Observer
270
  * @return bool
271
  * @throws Exception
272
  */
273
- public function saveShipment(Varien_Event_Observer $observer)
274
  {
275
  $event = $observer->getEvent();
276
  /** @var $_shipment Mage_Sales_Model_Order_Shipment */
277
  $_shipment = $event->getShipment();
278
  /** @var $_order Mage_Sales_Model_Order */
279
  $_order = $_shipment->getOrder();
 
280
  $storeId = $_order->getStoreId();
281
  $channelOrder = Mage::getModel('channelengine/order')->loadByOrderId($_order->getId());
282
  $channelOrderId = $channelOrder->getChannelOrderId();
115
  // Add product to quote
116
  try {
117
  $_quoteItem = $quote->addProduct($_product, $params);
118
+
119
+ if(is_string($_quoteItem)) {
120
+ // Magento sometimes returns a string when the method fails. -_-"
121
+ Mage::throwException('Failed to create quote item: ' . $_quoteItem);
122
+ }
123
+
124
  $_quoteItem->setChannelengineOrderLineId($item->getId());
125
 
126
  } catch (Exception $e) {
276
  * @return bool
277
  * @throws Exception
278
  */
279
+ public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer)
280
  {
281
  $event = $observer->getEvent();
282
  /** @var $_shipment Mage_Sales_Model_Order_Shipment */
283
  $_shipment = $event->getShipment();
284
  /** @var $_order Mage_Sales_Model_Order */
285
  $_order = $_shipment->getOrder();
286
+
287
  $storeId = $_order->getStoreId();
288
  $channelOrder = Mage::getModel('channelengine/order')->loadByOrderId($_order->getId());
289
  $channelOrderId = $channelOrder->getChannelOrderId();
app/code/community/Tritac/ChannelEngine/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Tritac_ChannelEngine>
5
- <version>2.3.6</version>
6
  </Tritac_ChannelEngine>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Tritac_ChannelEngine>
5
+ <version>2.5.0</version>
6
  </Tritac_ChannelEngine>
7
  </modules>
8
 
app/code/community/Tritac/ChannelEngine/etc/system.xml CHANGED
@@ -129,7 +129,7 @@
129
  <label>Generate product feed</label>
130
  <button_label>Generate Product Feed</button_label>
131
  <comment>
132
- <![CDATA[<span class="notice">You need to configure cronjobs on your server to automatically generate feeds automatically</span>]]>
133
  </comment>
134
  <frontend_model>channelengine/adminhtml_system_config_feed</frontend_model>
135
  <sort_order>5</sort_order>
129
  <label>Generate product feed</label>
130
  <button_label>Generate Product Feed</button_label>
131
  <comment>
132
+ <![CDATA[<span class="notice">You need to configure cronjobs on your server to generate feeds automatically</span>]]>
133
  </comment>
134
  <frontend_model>channelengine/adminhtml_system_config_feed</frontend_model>
135
  <sort_order>5</sort_order>
lib/Tritac/ChannelEngineApiClient/Client.php CHANGED
@@ -10,6 +10,8 @@ class Tritac_ChannelEngineApiClient_Client {
10
  private $apiKey;
11
  private $apiSecret;
12
 
 
 
13
  const FIDDLER_PROXY = '127.0.0.1:8888';
14
  const USE_FIDDLER = false;
15
  const FIDDLER_CERTIFICATE_PATH = 'fiddler.crt';
@@ -18,11 +20,11 @@ class Tritac_ChannelEngineApiClient_Client {
18
  const ENV_ACCEPTATION = 'acc';
19
  const ENV_PRODUCTION = 'prod';
20
 
21
- const DEV_URL = 'http://%s-api.channelengine.local';
22
- const ACC_URL = 'http://%s-api.channelengine-acc.nl';
23
- const PROD_URL = 'https://%s-api.channelengine.net';
24
 
25
- const BASE_PATH = '/v1/merchant/';
26
  const CERTIFICATE_PATH = 'AddTrustExternalCARoot.crt';
27
 
28
  const ORDERS_PATH = 'orders/';
@@ -50,6 +52,8 @@ class Tritac_ChannelEngineApiClient_Client {
50
  $this->apiKey = $apiKey;
51
  $this->apiSecret = $apiSecret;
52
  $this->certificate = __DIR__ . DIRECTORY_SEPARATOR . (self::USE_FIDDLER ? self::FIDDLER_CERTIFICATE_PATH : self::CERTIFICATE_PATH);
 
 
53
  }
54
 
55
  /* Public API methods */
@@ -189,9 +193,13 @@ class Tritac_ChannelEngineApiClient_Client {
189
  $message = Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($response, 'Tritac_ChannelEngineApiClient_Models_Message');
190
  curl_close($request);
191
 
192
- throw new Exception('Output headers: '. "\n" . $headers ."\n\n".
193
- 'Content: ' . $content ."\n\n".
194
- 'Unexpected status code [' . $status . ']. The server returned the following message: "' . $message->getMessage() . '"');
 
 
 
 
195
  }
196
  else
197
  {
@@ -235,10 +243,10 @@ class Tritac_ChannelEngineApiClient_Client {
235
  (strlen($content) > 0) ? base64_encode(md5($content, true)) : '',
236
  $this->apiKey
237
  );
238
-
239
-
240
  $representationString = implode("\n", $representation);
241
 
 
 
242
  $hash = hash_hmac('sha256', utf8_encode($representationString), utf8_encode($this->apiSecret), true);
243
  $signature = base64_encode($hash);
244
 
10
  private $apiKey;
11
  private $apiSecret;
12
 
13
+ private $lastRepresentation;
14
+
15
  const FIDDLER_PROXY = '127.0.0.1:8888';
16
  const USE_FIDDLER = false;
17
  const FIDDLER_CERTIFICATE_PATH = 'fiddler.crt';
20
  const ENV_ACCEPTATION = 'acc';
21
  const ENV_PRODUCTION = 'prod';
22
 
23
+ const DEV_URL = 'http://%s.channelengine.local';
24
+ const ACC_URL = 'http://%s.channelengine-acc.nl';
25
+ const PROD_URL = 'https://%s.channelengine.net';
26
 
27
+ const BASE_PATH = '/api/v1/';
28
  const CERTIFICATE_PATH = 'AddTrustExternalCARoot.crt';
29
 
30
  const ORDERS_PATH = 'orders/';
52
  $this->apiKey = $apiKey;
53
  $this->apiSecret = $apiSecret;
54
  $this->certificate = __DIR__ . DIRECTORY_SEPARATOR . (self::USE_FIDDLER ? self::FIDDLER_CERTIFICATE_PATH : self::CERTIFICATE_PATH);
55
+
56
+ $this->lastRepresentation = '';
57
  }
58
 
59
  /* Public API methods */
193
  $message = Tritac_ChannelEngineApiClient_Helpers_JsonMapper::fromJson($response, 'Tritac_ChannelEngineApiClient_Models_Message');
194
  curl_close($request);
195
 
196
+ throw new Exception("\r\n".
197
+ '------Sent Headers-------------' . "\r\n" . $headers . "\r\n" .
198
+ '------Sent Content-------------' . "\r\n" . $content . "\r\n" .
199
+ '------Used Representation------' . "\r\n" . $this->lastRepresentation . "\r\n" .
200
+ '------Response Status----------' . "\r\n" . $status . "\r\n" .
201
+ '------Response Content---------' . "\r\n" . $message->getMessage() . "\r\n"
202
+ );
203
  }
204
  else
205
  {
243
  (strlen($content) > 0) ? base64_encode(md5($content, true)) : '',
244
  $this->apiKey
245
  );
 
 
246
  $representationString = implode("\n", $representation);
247
 
248
+ $this->lastRepresentation = $representationString;
249
+
250
  $hash = hash_hmac('sha256', utf8_encode($representationString), utf8_encode($this->apiSecret), true);
251
  $signature = base64_encode($hash);
252
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Tritac_ChannelEngine</name>
4
- <version>2.3.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connect your Magento shop to the ChannelEngine platform.</summary>
10
  <description>Easily offer your products on comparison websites and marketplaces using the ChannelEngine platform.</description>
11
- <notes>* Minor fixes</notes>
12
  <authors><author><name>ChannelEngine</name><user>christiaander</user><email>christiaan@tritac.com</email></author></authors>
13
- <date>2014-07-14</date>
14
- <time>09:40:48</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Tritac_ChannelEngine.xml" hash="014b02d581d1039764cdc422e8f86643"/></dir></target><target name="magecommunity"><dir name="Tritac"><dir name="ChannelEngine"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Feed.php" hash="cbc5bf15ab9cd9bb5b2bc97375db3eb2"/></dir></dir></dir><file name="Head.php" hash="98a65067f1ae6074f2c276624164c183"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="097e10d1e9e6dd8c5aee66124376cae4"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="bf1203d5f080b340404f02c51967f328"/></dir><dir name="Model"><dir name="Carrier"><file name="Channelengine.php" hash="a9f4a062739d3ae4c542093888a0f5fc"/></dir><file name="Observer.php" hash="7a8d1d66ea5f353c78137ac2ec1f50be"/><file name="Order.php" hash="66c8e7c0ac47f9dbabb156eaa8c97f1e"/><dir name="Payment"><dir name="Method"><file name="Channelengine.php" hash="49ef02953b486cfbf813d37e681172a3"/></dir></dir><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="989bbd95481d2954d7813e19d8c27d18"/></dir><file name="Order.php" hash="3813fe3ad637daf069d79bca1feea540"/><file name="Setup.php" hash="24934fe022e3bb93331fcbfb7a116d37"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Gtin.php" hash="d182d37bc836ef718858c985c27b3c3c"/><file name="Shipping.php" hash="103486f575dcd6205fc9cfd40f2fa5ea"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="GenerateController.php" hash="edde582db1fbb091e14396b247cd0d45"/></dir><file name="TestController.php" hash="1f579ff8fd8ffeb9a8ce25dde0d0fc11"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5a976b638c6ad66287ba3084fdbfc157"/><file name="config.xml" hash="f66078a0a91c1f0ae6f6792ac9632444"/><file name="system.xml" hash="dec9123b13aac4340dea2307e7855525"/></dir><dir name="sql"><dir name="channelengine_setup"><file name="mysql4-install-0.1.0.0.php" hash="312e7c69f98c8d13d251b8ed1ca93448"/><file name="mysql4-install-1.0.0.php" hash="3664f3c5b6e01db69cbea8b4b0beb9ab"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Tritac"><dir name="ChannelEngineApiClient"><file name="AddTrustExternalCARoot.crt" hash="f85d1ff17b0079709f131f3ce3f288d2"/><file name="Client.php" hash="6b17bfb6a9c9f8af6086cd46fda24106"/><dir name="Enums"><file name="CancellationLineStatus.php" hash="0fe455ad75e49b2796d4bcd1230a3c0d"/><file name="CancellationStatus.php" hash="e4a26c1a29afe02d92320187277f5d03"/><file name="Gender.php" hash="49645506c67b6ad530e1463da256d403"/><file name="MancoReason.php" hash="80388c0545fa091fd9e651fc1284b77d"/><file name="OrderStatus.php" hash="855341235149ff3c9d3a36a5a23f8db0"/><file name="ReturnAcceptStatus.php" hash="de4252a8f9d7b94493b470cccd9feaec"/><file name="ReturnReason.php" hash="05d5fd5b23af84508b8bec92137c421d"/><file name="ReturnStatus.php" hash="ba9350e9ba015ec9cac4b1ab7702333c"/><file name="ShipmentLineStatus.php" hash="8329dce7182fc7705bb8008da6a7e26f"/><file name="ShipmentStatus.php" hash="d73e4a5b58487c7b0c80b114601d3279"/></dir><dir name="Helpers"><file name="Collection.php" hash="2278a5e6d8d65ebca92ba1e968680315"/><file name="HttpMethod.php" hash="4949b2cfe4a309a54b1642fa09bda53b"/><file name="JsonMapper.php" hash="f8e30cab83a2f2ccfdb2a64636c2346b"/></dir><dir name="Models"><file name="Address.php" hash="543aff76425e3335cbba2a1cdd25564d"/><file name="BaseModel.php" hash="65f09d298baa6496807a2f71ea93a8f8"/><file name="Cancellation.php" hash="4e845b4bd2076a5426f13e6763b41271"/><file name="CancellationLine.php" hash="e8820be847e77d5f77a2de8cb551a8a0"/><file name="Message.php" hash="e0cea12494684d58abea051958082036"/><file name="Order.php" hash="db5ecd35bf5e2158ac27565bd1c95a8a"/><file name="OrderExtraDataItem.php" hash="eaf59ef83070360c4c7bb2c3f5c5633a"/><file name="OrderLine.php" hash="11372030afba1ed751e5a99ccf14d7c9"/><file name="ReturnLine.php" hash="c1cbf7c45a85280782955be400c478e6"/><file name="ReturnObject.php" hash="6cf979eb91ce737464620575ada1c8e9"/><file name="Shipment.php" hash="246d699692e4fd9bad5db370648f717f"/><file name="ShipmentLine.php" hash="5c738023584cd6513940be54b8f8dc60"/></dir><file name="loader.php" hash="3daea8be627858c27383a79a29663c82"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="channelengine"><dir name="system"><dir name="config"><dir name="feed"><file name="generate_button.phtml" hash="11f261e8aee3ddfe2cd611bb8eae573e"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="channelengine.xml" hash="d4019283d7ff05708cfac73363f598b8"/></dir><dir name="template"><dir name="channelengine"><dir name="checkout"><file name="success.phtml" hash="eea5605084a179e06c8ea922bfcdd55c"/></dir><file name="head.phtml" hash="638dd695feb9aeaf343183cc3c5d77e1"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Tritac_ChannelEngine</name>
4
+ <version>2.5.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connect your Magento shop to the ChannelEngine platform.</summary>
10
  <description>Easily offer your products on comparison websites and marketplaces using the ChannelEngine platform.</description>
11
+ <notes>* Better order import handling</notes>
12
  <authors><author><name>ChannelEngine</name><user>christiaander</user><email>christiaan@tritac.com</email></author></authors>
13
+ <date>2014-09-02</date>
14
+ <time>10:13:58</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Tritac_ChannelEngine.xml" hash="014b02d581d1039764cdc422e8f86643"/></dir></target><target name="magecommunity"><dir name="Tritac"><dir name="ChannelEngine"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Feed.php" hash="cbc5bf15ab9cd9bb5b2bc97375db3eb2"/></dir></dir></dir><file name="Head.php" hash="98a65067f1ae6074f2c276624164c183"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="097e10d1e9e6dd8c5aee66124376cae4"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="bf1203d5f080b340404f02c51967f328"/></dir><dir name="Model"><dir name="Carrier"><file name="Channelengine.php" hash="a9f4a062739d3ae4c542093888a0f5fc"/></dir><file name="Observer.php" hash="fa033111cba066084b6deaf64a3dd323"/><file name="Order.php" hash="66c8e7c0ac47f9dbabb156eaa8c97f1e"/><dir name="Payment"><dir name="Method"><file name="Channelengine.php" hash="49ef02953b486cfbf813d37e681172a3"/></dir></dir><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="989bbd95481d2954d7813e19d8c27d18"/></dir><file name="Order.php" hash="3813fe3ad637daf069d79bca1feea540"/><file name="Setup.php" hash="24934fe022e3bb93331fcbfb7a116d37"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Gtin.php" hash="d182d37bc836ef718858c985c27b3c3c"/><file name="Shipping.php" hash="103486f575dcd6205fc9cfd40f2fa5ea"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="GenerateController.php" hash="edde582db1fbb091e14396b247cd0d45"/></dir><file name="TestController.php" hash="1f579ff8fd8ffeb9a8ce25dde0d0fc11"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5a976b638c6ad66287ba3084fdbfc157"/><file name="config.xml" hash="28cacf440337ad2ca33d4d512a5039ab"/><file name="system.xml" hash="de0e1158e239833891707739313ac8c6"/></dir><dir name="sql"><dir name="channelengine_setup"><file name="mysql4-install-0.1.0.0.php" hash="312e7c69f98c8d13d251b8ed1ca93448"/><file name="mysql4-install-1.0.0.php" hash="3664f3c5b6e01db69cbea8b4b0beb9ab"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Tritac"><dir name="ChannelEngineApiClient"><file name="AddTrustExternalCARoot.crt" hash="f85d1ff17b0079709f131f3ce3f288d2"/><file name="Client.php" hash="e05c3d240ebf578af9f69ea123870807"/><dir name="Enums"><file name="CancellationLineStatus.php" hash="0fe455ad75e49b2796d4bcd1230a3c0d"/><file name="CancellationStatus.php" hash="e4a26c1a29afe02d92320187277f5d03"/><file name="Gender.php" hash="49645506c67b6ad530e1463da256d403"/><file name="MancoReason.php" hash="80388c0545fa091fd9e651fc1284b77d"/><file name="OrderStatus.php" hash="855341235149ff3c9d3a36a5a23f8db0"/><file name="ReturnAcceptStatus.php" hash="de4252a8f9d7b94493b470cccd9feaec"/><file name="ReturnReason.php" hash="05d5fd5b23af84508b8bec92137c421d"/><file name="ReturnStatus.php" hash="ba9350e9ba015ec9cac4b1ab7702333c"/><file name="ShipmentLineStatus.php" hash="8329dce7182fc7705bb8008da6a7e26f"/><file name="ShipmentStatus.php" hash="d73e4a5b58487c7b0c80b114601d3279"/></dir><dir name="Helpers"><file name="Collection.php" hash="2278a5e6d8d65ebca92ba1e968680315"/><file name="HttpMethod.php" hash="4949b2cfe4a309a54b1642fa09bda53b"/><file name="JsonMapper.php" hash="f8e30cab83a2f2ccfdb2a64636c2346b"/></dir><dir name="Models"><file name="Address.php" hash="543aff76425e3335cbba2a1cdd25564d"/><file name="BaseModel.php" hash="65f09d298baa6496807a2f71ea93a8f8"/><file name="Cancellation.php" hash="4e845b4bd2076a5426f13e6763b41271"/><file name="CancellationLine.php" hash="e8820be847e77d5f77a2de8cb551a8a0"/><file name="Message.php" hash="e0cea12494684d58abea051958082036"/><file name="Order.php" hash="db5ecd35bf5e2158ac27565bd1c95a8a"/><file name="OrderExtraDataItem.php" hash="eaf59ef83070360c4c7bb2c3f5c5633a"/><file name="OrderLine.php" hash="11372030afba1ed751e5a99ccf14d7c9"/><file name="ReturnLine.php" hash="c1cbf7c45a85280782955be400c478e6"/><file name="ReturnObject.php" hash="6cf979eb91ce737464620575ada1c8e9"/><file name="Shipment.php" hash="246d699692e4fd9bad5db370648f717f"/><file name="ShipmentLine.php" hash="5c738023584cd6513940be54b8f8dc60"/></dir><file name="loader.php" hash="3daea8be627858c27383a79a29663c82"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="channelengine"><dir name="system"><dir name="config"><dir name="feed"><file name="generate_button.phtml" hash="11f261e8aee3ddfe2cd611bb8eae573e"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="channelengine.xml" hash="d4019283d7ff05708cfac73363f598b8"/></dir><dir name="template"><dir name="channelengine"><dir name="checkout"><file name="success.phtml" hash="eea5605084a179e06c8ea922bfcdd55c"/></dir><file name="head.phtml" hash="638dd695feb9aeaf343183cc3c5d77e1"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
18
  </package>