Version Notes
The ChannelUnity connector kit for Magento.
Resolves an issue when copying product data where catalog flat product is enabled.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Camiloo_Channelunity |
Version | 1.0.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.0.4 to 1.0.0.5
app/code/community/Camiloo/Channelunity/Model/Collection.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (version_compare(Mage::getVersion(), "1.
|
3 |
|
4 |
class Camiloo_Channelunity_Model_Collection extends Mage_Catalog_Model_Resource_Product_Collection {
|
5 |
public function isEnabledFlat()
|
1 |
<?php
|
2 |
+
if (version_compare(Mage::getVersion(), "1.6.0.0", ">=")) {
|
3 |
|
4 |
class Camiloo_Channelunity_Model_Collection extends Mage_Catalog_Model_Resource_Product_Collection {
|
5 |
public function isEnabledFlat()
|
app/code/community/Camiloo/Channelunity/Model/Orders.php
CHANGED
@@ -214,17 +214,46 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
|
|
214 |
$quote->addItem($item);
|
215 |
}
|
216 |
else {
|
217 |
-
echo "<Info>Can't find SKU to add to quote ".(string) $orderitem->SKU.", trying to create stub</Info>";
|
218 |
|
219 |
-
|
220 |
-
$this->createStubProduct((string) $orderitem->SKU, (string) $orderitem->Name,
|
221 |
-
(string) $dataArray->WebsiteId,
|
222 |
-
(string) $order->OrderId, (string) $orderitem->Price,
|
223 |
-
(string) $orderitem->Quantity);
|
224 |
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
(string) $orderitem->SKU);
|
|
|
|
|
228 |
|
229 |
if (is_object($product)) {
|
230 |
|
@@ -236,7 +265,7 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
|
|
236 |
$quote->addItem($item);
|
237 |
}
|
238 |
else {
|
239 |
-
echo "<Info>Can't find SKU to add to quote ".(string) $orderitem->SKU."</Info>";
|
240 |
}
|
241 |
}
|
242 |
}
|
@@ -447,7 +476,7 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
|
|
447 |
|
448 |
}
|
449 |
|
450 |
-
private function createStubProduct($missingSku, $productTitle, $websiteID, $keyorder, $price, $qty) {
|
451 |
$product = new Mage_Catalog_Model_Product();
|
452 |
|
453 |
$db = Mage::getSingleton("core/resource")->getConnection("core_write");
|
@@ -466,7 +495,7 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
|
|
466 |
$product->setAttributeSetId($attributeSetId);
|
467 |
$product->setTypeId('simple');
|
468 |
$product->setName($productTitle);
|
469 |
-
//
|
470 |
|
471 |
$product->setWebsiteIDs(array($websiteID)); # derive website ID from store.
|
472 |
$product->setDescription('Product missing from imported order ID '.$keyorder);
|
@@ -475,7 +504,6 @@ class Camiloo_Channelunity_Model_Orders extends Camiloo_Channelunity_Model_Abstr
|
|
475 |
|
476 |
// Default Magento attribute
|
477 |
$product->setWeight('0.01');
|
478 |
-
|
479 |
$product->setVisibility(1); // not visible
|
480 |
$product->setStatus(1); // status = enabled, other price shows as 0.00 in the order
|
481 |
$product->setTaxClassId(0); # My default tax class
|
214 |
$quote->addItem($item);
|
215 |
}
|
216 |
else {
|
217 |
+
echo "<Info>Can't find SKU to add to quote ".((string) $orderitem->SKU).", trying to create stub</Info>";
|
218 |
|
219 |
+
$prodIdToLoad = 0;
|
|
|
|
|
|
|
|
|
220 |
|
221 |
+
try {
|
222 |
+
// Create stub if needed
|
223 |
+
$this->createStubProduct((string) $orderitem->SKU, (string) $orderitem->Name,
|
224 |
+
(string) $dataArray->WebsiteId,
|
225 |
+
(string) $order->OrderId, (string) $orderitem->Price,
|
226 |
+
(string) $orderitem->Quantity,
|
227 |
+
(string) $dataArray->SkuAttribute);
|
228 |
+
}
|
229 |
+
catch (Exception $e) {
|
230 |
+
echo "<Info><![CDATA[Stub create error - ".$e->getMessage()."]]></Info>";
|
231 |
+
|
232 |
+
if (strpos($e->getMessage(), "Duplicate entry")) {
|
233 |
+
|
234 |
+
$msgParts = explode("Duplicate entry '", $e->getMessage());
|
235 |
+
|
236 |
+
if (isset($msgParts[1])) {
|
237 |
+
|
238 |
+
$msgParts = $msgParts[1];
|
239 |
+
$msgParts = explode("-", $msgParts);
|
240 |
+
$prodIdToLoad = $msgParts[0];
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
if ($prodIdToLoad > 0) {
|
246 |
+
|
247 |
+
echo "<Info>Load by ID $prodIdToLoad</Info>";
|
248 |
+
$product = Mage::getModel('catalog/product')->load($prodIdToLoad);
|
249 |
+
}
|
250 |
+
else {
|
251 |
+
|
252 |
+
// Try once again to add our item to the quote
|
253 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',
|
254 |
(string) $orderitem->SKU);
|
255 |
+
|
256 |
+
}
|
257 |
|
258 |
if (is_object($product)) {
|
259 |
|
265 |
$quote->addItem($item);
|
266 |
}
|
267 |
else {
|
268 |
+
echo "<Info>Can't find SKU to add to quote ".((string) $orderitem->SKU)."</Info>";
|
269 |
}
|
270 |
}
|
271 |
}
|
476 |
|
477 |
}
|
478 |
|
479 |
+
private function createStubProduct($missingSku, $productTitle, $websiteID, $keyorder, $price, $qty, $skuAttribute) {
|
480 |
$product = new Mage_Catalog_Model_Product();
|
481 |
|
482 |
$db = Mage::getSingleton("core/resource")->getConnection("core_write");
|
495 |
$product->setAttributeSetId($attributeSetId);
|
496 |
$product->setTypeId('simple');
|
497 |
$product->setName($productTitle);
|
498 |
+
$product->setData($skuAttribute, $missingSku); // set the attribute marked as the SKU attribute
|
499 |
|
500 |
$product->setWebsiteIDs(array($websiteID)); # derive website ID from store.
|
501 |
$product->setDescription('Product missing from imported order ID '.$keyorder);
|
504 |
|
505 |
// Default Magento attribute
|
506 |
$product->setWeight('0.01');
|
|
|
507 |
$product->setVisibility(1); // not visible
|
508 |
$product->setStatus(1); // status = enabled, other price shows as 0.00 in the order
|
509 |
$product->setTaxClassId(0); # My default tax class
|
app/design/adminhtml/default/default/template/channelunity/configheader.phtml
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
<h3>ChannelUnity Integration for Magento</h3>
|
17 |
Devised and Developed in Manchester, UK by <a href="http://www.camiloo.co.uk/?ref=cu" target="_blank">Camiloo Limited</a><br />
|
18 |
<?php
|
19 |
-
$xml = Mage::getModel('channelunity/checkforupdates')->getRemoteXMLFileData("http://my.channelunity.com/versioncheck.php?Version=1.0.0.
|
20 |
$html = $xml->DisplayMessage[0];
|
21 |
echo $html;
|
22 |
?>
|
16 |
<h3>ChannelUnity Integration for Magento</h3>
|
17 |
Devised and Developed in Manchester, UK by <a href="http://www.camiloo.co.uk/?ref=cu" target="_blank">Camiloo Limited</a><br />
|
18 |
<?php
|
19 |
+
$xml = Mage::getModel('channelunity/checkforupdates')->getRemoteXMLFileData("http://my.channelunity.com/versioncheck.php?Version=1.0.0.5");
|
20 |
$html = $xml->DisplayMessage[0];
|
21 |
echo $html;
|
22 |
?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Camiloo_Channelunity</name>
|
4 |
-
<version>1.0.0.
|
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 |
-
|
15 |
<authors><author><name>Camiloo Limited</name><user>auto-converted</user><email>hello@camiloo.co.uk</email></author></authors>
|
16 |
-
<date>2012-05-
|
17 |
-
<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="
|
19 |
<compatible/>
|
20 |
<dependencies/>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Camiloo_Channelunity</name>
|
4 |
+
<version>1.0.0.5</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 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-30</date>
|
17 |
+
<time>10:36:56</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="490c089a0cc71b8c5b049d767fd670a8"/><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>
|