Camiloo_Channelunity - Version 1.0.0.7

Version Notes

The ChannelUnity connector kit for Magento.
Resolves an issue where orders already cancelled on the marketplace not already imported into Magento were duplicated.

Download this release

Release Info

Developer Magento Core Team
Extension Camiloo_Channelunity
Version 1.0.0.7
Comparing to
See all releases


Code changes from version 1.0.0.6 to 1.0.0.7

app/code/community/Camiloo/Channelunity/Model/Orders.php CHANGED
@@ -270,12 +270,14 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
270
}
271
}
272
273
-
274
echo "<Info>Set Billing Address</Info>";
275
276
$postcode = $this->fixEncoding((string) $order->ShippingInfo->PostalCode);
277
$postcode = str_replace("-", "_", $postcode); // can throw exception if - in postcode
278
-
279
// set the billing address
280
$billingAddressData = array(
281
'firstname' => $this->fixEncoding($this->getFirstName((string) $order->BillingInfo->Name)),
@@ -291,7 +293,7 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
291
'city' => $this->fixEncoding((string) $order->ShippingInfo->City),
292
'postcode' => $postcode,
293
'region' => (string) $order->ShippingInfo->State,
294
- 'region_id' => (string) $order->ShippingInfo->State,
295
'country_id' => (string) $order->ShippingInfo->Country
296
);
297
@@ -311,14 +313,13 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
311
'city' => $this->fixEncoding((string) $order->ShippingInfo->City),
312
'postcode' => $postcode,
313
'region' => (string) $order->ShippingInfo->State,
314
- 'region_id' => (string) $order->ShippingInfo->State,
315
'country_id' => (string) $order->ShippingInfo->Country,
316
'telephone' => (string) $order->ShippingInfo->PhoneNumber
317
);
318
319
Mage::getSingleton('core/session')->setShippingPrice(((string) $order->ShippingInfo->ShippingPrice) / $reverseRate);
320
- // Mage::getSingleton('core/session')->setShippingMethod((string) $order->ShippingInfo->Service);
321
-
322
// add the shipping address to the quote.
323
$shippingAddress = $quote->getShippingAddress()->addData($shippingAddressData);
324
/////////////////////////////////////////////
@@ -367,7 +368,7 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
367
}
368
369
} catch (Exception $x) {
370
- echo "<Exception><![CDATA[".$x->getMessage()."]]></Exception>";
371
echo "<NotImported>".((string) $order->OrderId)."</NotImported>";
372
return;
373
}
@@ -587,13 +588,13 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
587
$ordStatus = $this->CUOrderStatusToMagentoStatus((string) $singleOrder->OrderStatus);
588
589
try {
590
- $newOrder->setState($ordStatus, $ordStatus, 'Order updated from ChannelUnity', false);
591
592
}
593
catch (Exception $x1) {
594
595
try {
596
- $newOrder->setState('closed', 'closed', 'Order updated from ChannelUnity', false);
597
598
}
599
catch (Exception $x2) {
@@ -749,8 +750,15 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
749
$this->reserveStock($dataArray, $order);
750
}
751
else {
752
- // Just create the order (e.g. previously completed)
753
- $this->doCreate($dataArray, $order);
754
}
755
}
756
270
}
271
}
272
273
echo "<Info>Set Billing Address</Info>";
274
275
$postcode = $this->fixEncoding((string) $order->ShippingInfo->PostalCode);
276
$postcode = str_replace("-", "_", $postcode); // can throw exception if - in postcode
277
+
278
+ $regionModel = Mage::getModel('directory/region')->loadByCode((string) $order->ShippingInfo->State, (string) $order->ShippingInfo->Country);
279
+ $regionId = is_object($regionModel) ? $regionModel->getId() : ((string) $order->ShippingInfo->State);
280
+
281
// set the billing address
282
$billingAddressData = array(
283
'firstname' => $this->fixEncoding($this->getFirstName((string) $order->BillingInfo->Name)),
293
'city' => $this->fixEncoding((string) $order->ShippingInfo->City),
294
'postcode' => $postcode,
295
'region' => (string) $order->ShippingInfo->State,
296
+ 'region_id' => $regionId,
297
'country_id' => (string) $order->ShippingInfo->Country
298
);
299
313
'city' => $this->fixEncoding((string) $order->ShippingInfo->City),
314
'postcode' => $postcode,
315
'region' => (string) $order->ShippingInfo->State,
316
+ 'region_id' => $regionId,
317
'country_id' => (string) $order->ShippingInfo->Country,
318
'telephone' => (string) $order->ShippingInfo->PhoneNumber
319
);
320
321
Mage::getSingleton('core/session')->setShippingPrice(((string) $order->ShippingInfo->ShippingPrice) / $reverseRate);
322
+
323
// add the shipping address to the quote.
324
$shippingAddress = $quote->getShippingAddress()->addData($shippingAddressData);
325
/////////////////////////////////////////////
368
}
369
370
} catch (Exception $x) {
371
+ echo "<Exception><![CDATA[".$x->getMessage()." ".$x->getTraceAsString()."]]></Exception>";
372
echo "<NotImported>".((string) $order->OrderId)."</NotImported>";
373
return;
374
}
588
$ordStatus = $this->CUOrderStatusToMagentoStatus((string) $singleOrder->OrderStatus);
589
590
try {
591
+ $newOrder->setState($ordStatus /*, $ordStatus, 'Order updated from ChannelUnity', false */);
592
593
}
594
catch (Exception $x1) {
595
596
try {
597
+ $newOrder->setState('closed' /*, 'closed', 'Order updated from ChannelUnity', false */);
598
599
}
600
catch (Exception $x2) {
750
$this->reserveStock($dataArray, $order);
751
}
752
else {
753
+ // Let's not create cancelled orders !!! We don't have all the details
754
+ if ( "Cancelled" != ((string) $order->OrderStatus) ){
755
+ // Just create the order (e.g. previously completed)
756
+ $this->doCreate($dataArray, $order);
757
+ }
758
+ else {
759
+ // Have this order marked as imported anyway
760
+ echo "<Imported>".((string) $order->OrderId)."</Imported>";
761
+ }
762
}
763
}
764
package.xml CHANGED
@@ -1,7 +1,7 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Camiloo_Channelunity</name>
4
- <version>1.0.0.6</version>
5
<stability>stable</stability>
6
<license uri="http://www.camiloo.co.uk/license.txt">Camiloo EULA</license>
7
<channel>community</channel>
@@ -11,11 +11,11 @@
11
12
Should you need any help getting started, please email support@camiloo.co.uk</description>
13
<notes>The ChannelUnity connector kit for Magento.
14
- Resolves an issue when copying product data where catalog flat product is enabled.</notes>
15
<authors><author><name>Camiloo Limited</name><user>auto-converted</user><email>hello@camiloo.co.uk</email></author></authors>
16
- <date>2012-05-31</date>
17
- <time>20:07:00</time>
18
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="channelunity"><file name="configheader.phtml" hash="943b579d8dd91f2afc813fdf011e7351"/><file name="paymentinfo.phtml" hash="60967f7ab38fe17c879b272eed25f986"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Camiloo"><dir name="Channelunity"><dir name="Block"><file name="Configheader.php" hash="6d7de078f04901e94b8b9675bcd9e4ac"/><file name="Paymentform.php" hash="1f3e79556f15a57b9761c3665a103103"/><file name="Paymentinfo.php" hash="6c3c36d92592dd802fb8045dc065d231"/></dir><dir name="controllers"><file name="ApiController.php" hash="6cc9052f6dd80e9460bc40d208fb5779"/><file name="ApiController.php.old.php" hash="01ff34c2cf5798a82cfc11b19ab6decd"/></dir><dir name="etc"><file name="config.xml" hash="4d813910e0807b964b3e68484eb38f41"/><file name="system.xml" hash="b43f861f8ab3dadca3c122be10790609"/></dir><dir name="Helper"><file name="Data.php" hash="857d7d23882394c33f96e14dece757c2"/></dir><dir name="Model"><file name="Abstract.php" hash="de4075b91bbb176c807ad12061789774"/><file name="Attributes.php" hash="054b33cadc22acda31056e5b4cb8ff56"/><file name="Categories.php" hash="fd3806b220fd579b00bc5ab5fd464170"/><file name="Checkforupdates.php" hash="e2675f59cc61e54ad1a20f76865ce653"/><file name="Collection.php" hash="2fee7c15f58053c7b8fc9a2c011b97ac"/><file name="Customrate.php" hash="f388bd243823436828c1bb214b3f81be"/><file name="Entity.php" hash="0032a6c24cb75beb2ae073a56c2a1564"/><file name="Observer.php" hash="f734886fbecb301e766eeeeb8e95f2f3"/><file name="Ordercreatebackport.php" hash="3b696fb97ce6550a967d76436a3d131c"/><file name="Orders.php" hash="56951f913fe1edce017a1df7b261b9aa"/><file name="Payment.php" hash="7fe570cf0aaf7c2bcdf1982b6e69caa6"/><file name="Paymentinfo.php" hash="e11658c9fa02420557441f5c8a41f8a0"/><file name="Paymentmethoduk.php" hash="a99409ed4ee5f7e426df4eaf793482d6"/><file name="Products.php" hash="2b707afa872a220afb3d5c1560af7743"/><file name="Stores.php" hash="7f299877f0b62ca9d30a46b333124680"/></dir><dir name="sql"><dir name="channelunity_setup"><file name="install-1.0.0.php" hash="7127fff7219108813aa35dd7596b09d3"/><file name="mysql4-install-0.0.1.php" hash="7ebc892c87b9401bf402a7e1976133e3"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Camiloo_Channelunity.xml" hash="cccfbce64ee176372c5afecb8676fab0"/></dir></target></contents>
19
<compatible/>
20
<dependencies/>
21
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Camiloo_Channelunity</name>
4
+ <version>1.0.0.7</version>
5
<stability>stable</stability>
6
<license uri="http://www.camiloo.co.uk/license.txt">Camiloo EULA</license>
7
<channel>community</channel>
11
12
Should you need any help getting started, please email support@camiloo.co.uk</description>
13
<notes>The ChannelUnity connector kit for Magento.
14
+ Resolves an issue where orders already cancelled on the marketplace not already imported into Magento were duplicated.</notes>
15
<authors><author><name>Camiloo Limited</name><user>auto-converted</user><email>hello@camiloo.co.uk</email></author></authors>
16
+ <date>2012-06-04</date>
17
+ <time>14:07:11</time>
18
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="channelunity"><file name="configheader.phtml" hash="943b579d8dd91f2afc813fdf011e7351"/><file name="paymentinfo.phtml" hash="60967f7ab38fe17c879b272eed25f986"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Camiloo"><dir name="Channelunity"><dir name="Block"><file name="Configheader.php" hash="6d7de078f04901e94b8b9675bcd9e4ac"/><file name="Paymentform.php" hash="1f3e79556f15a57b9761c3665a103103"/><file name="Paymentinfo.php" hash="6c3c36d92592dd802fb8045dc065d231"/></dir><dir name="controllers"><file name="ApiController.php" hash="6cc9052f6dd80e9460bc40d208fb5779"/><file name="ApiController.php.old.php" hash="01ff34c2cf5798a82cfc11b19ab6decd"/></dir><dir name="etc"><file name="config.xml" hash="4d813910e0807b964b3e68484eb38f41"/><file name="system.xml" hash="b43f861f8ab3dadca3c122be10790609"/></dir><dir name="Helper"><file name="Data.php" hash="857d7d23882394c33f96e14dece757c2"/></dir><dir name="Model"><file name="Abstract.php" hash="de4075b91bbb176c807ad12061789774"/><file name="Attributes.php" hash="054b33cadc22acda31056e5b4cb8ff56"/><file name="Categories.php" hash="fd3806b220fd579b00bc5ab5fd464170"/><file name="Checkforupdates.php" hash="e2675f59cc61e54ad1a20f76865ce653"/><file name="Collection.php" hash="2fee7c15f58053c7b8fc9a2c011b97ac"/><file name="Customrate.php" hash="f388bd243823436828c1bb214b3f81be"/><file name="Entity.php" hash="0032a6c24cb75beb2ae073a56c2a1564"/><file name="Observer.php" hash="f734886fbecb301e766eeeeb8e95f2f3"/><file name="Ordercreatebackport.php" hash="3b696fb97ce6550a967d76436a3d131c"/><file name="Orders.php" hash="4e183704166647a0effbe41d40ed12f4"/><file name="Payment.php" hash="7fe570cf0aaf7c2bcdf1982b6e69caa6"/><file name="Paymentinfo.php" hash="e11658c9fa02420557441f5c8a41f8a0"/><file name="Paymentmethoduk.php" hash="a99409ed4ee5f7e426df4eaf793482d6"/><file name="Products.php" hash="2b707afa872a220afb3d5c1560af7743"/><file name="Stores.php" hash="7f299877f0b62ca9d30a46b333124680"/></dir><dir name="sql"><dir name="channelunity_setup"><file name="install-1.0.0.php" hash="7127fff7219108813aa35dd7596b09d3"/><file name="mysql4-install-0.0.1.php" hash="7ebc892c87b9401bf402a7e1976133e3"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Camiloo_Channelunity.xml" hash="cccfbce64ee176372c5afecb8676fab0"/></dir></target></contents>
19
<compatible/>
20
<dependencies/>
21
</package>