Version Notes
Added Additional Logging for custom API.
Download this release
Release Info
Developer | nChannel |
Extension | nChannel_Communicator |
Version | 0.1.11 |
Comparing to | |
See all releases |
Code changes from version 0.1.10 to 0.1.11
app/code/community/Nchannel/Communicator/Model/Productutility/Api/V2.php
CHANGED
@@ -6,49 +6,41 @@ class Nchannel_Communicator_Model_Productutility_Api_V2 extends Nchannel_Communi
|
|
6 |
Mage::log("LinkConfigurable fired!" . $url, null, 'nChannel_Communicator.log');
|
7 |
return "Hello World! My argument is : " . $configurableProductID;
|
8 |
}
|
9 |
-
|
10 |
-
Mage::log('sku ' . $childSku,null,'nChannel_Communicator.log');
|
11 |
-
Mage::log('pid ' . $configurableProductID,null,'nChannel_Communicator.log');
|
12 |
$configurableProduct = Mage::getModel('catalog/product')->load($configurableProductID);
|
13 |
$loader = Mage::getResourceModel( 'catalog/product_type_configurable' )->load($configurableProduct,$configurableProductID);
|
14 |
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$childSku);
|
15 |
-
|
16 |
-
Mage::log($product->getSku(),null,'nChannel_Communicator.log');
|
17 |
-
//return print_r($configurableProduct,true);
|
18 |
-
//$ids = $configurableProduct->getTypeInstance(true)->getUsedProductIds();
|
19 |
$ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($configurableProductID);
|
20 |
-
|
21 |
-
//$ids = $configurableProduct->getUsedProductIds();
|
22 |
$newids = array();
|
23 |
-
|
24 |
-
Mage::log('Loop IDs',null,'nChannel_Communicator.log');
|
25 |
-
Mage::log('product id output: ' . $product->getId(),null,'nChannel_Communicator.log');
|
26 |
-
|
27 |
-
Mage::log('Adding Product: '.$childSku,null,'nChannel_Communicator.log');
|
28 |
|
|
|
29 |
foreach ( $ids as $arr ) {
|
30 |
foreach($arr as $id)
|
31 |
{
|
32 |
-
Mage::log('id output: ' . $id,null,'nChannel_Communicator.log');
|
33 |
-
|
34 |
$newids[$id] = 1;
|
35 |
-
|
36 |
}
|
37 |
}
|
38 |
-
|
39 |
$newids[$product->getId()] = 1;
|
40 |
|
41 |
try{
|
42 |
-
Mage::log('Saving Products', null, 'nChannel_Communicator.log');
|
|
|
|
|
43 |
$loader->saveProducts( $configurableProduct, array_keys( $newids ) );
|
44 |
} catch(exception $ex)
|
45 |
{
|
46 |
array_pop($newids);
|
47 |
$loader->saveProducts( $configurableProduct, array_keys( $newids ) );
|
48 |
-
Mage::log($ex->getMessage(),null,'nChannel_Communicator.log');
|
49 |
}
|
50 |
-
Mage::log('Product '.$childSku.' was added', null, 'nChannel_Communicator.log');
|
51 |
-
Mage::log('Complete', null, 'nChannel_Communicator.log');
|
52 |
return "Success!";
|
53 |
}
|
54 |
|
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 |
$configurableProduct = Mage::getModel('catalog/product')->load($configurableProductID);
|
13 |
$loader = Mage::getResourceModel( 'catalog/product_type_configurable' )->load($configurableProduct,$configurableProductID);
|
14 |
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$childSku);
|
15 |
+
|
|
|
|
|
|
|
16 |
$ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($configurableProductID);
|
17 |
+
|
|
|
18 |
$newids = array();
|
19 |
+
Mage::log('attachProductToConfigurable: current child product id output: ' . $product->getId(),null,'nChannel_Communicator.log');
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
Mage::log('attachProductToConfigurable: Loop existing IDs',null,'nChannel_Communicator.log');
|
22 |
foreach ( $ids as $arr ) {
|
23 |
foreach($arr as $id)
|
24 |
{
|
25 |
+
Mage::log('attachProductToConfigurable: existing id output: ' . $id,null,'nChannel_Communicator.log');
|
|
|
26 |
$newids[$id] = 1;
|
|
|
27 |
}
|
28 |
}
|
|
|
29 |
$newids[$product->getId()] = 1;
|
30 |
|
31 |
try{
|
32 |
+
Mage::log('attachProductToConfigurable: Saving Products', null, 'nChannel_Communicator.log');
|
33 |
+
Mage::log('attachProductToConfigurable: Configurable Product ID: ' . print_r($configurableProduct->getId(),true),null, 'nChannel_Communicator.log');
|
34 |
+
Mage::log('attachProductToConfigurable: Configurable Product Type: ' . print_r($configurableProduct->getTypeInstance(),true),null, 'nChannel_Communicator.log');
|
35 |
$loader->saveProducts( $configurableProduct, array_keys( $newids ) );
|
36 |
} catch(exception $ex)
|
37 |
{
|
38 |
array_pop($newids);
|
39 |
$loader->saveProducts( $configurableProduct, array_keys( $newids ) );
|
40 |
+
Mage::log('attachProductToConfigurable: erorr ->' . $ex->getMessage(),null,'nChannel_Communicator.log');
|
41 |
}
|
42 |
+
Mage::log('attachProductToConfigurable: Product '.$childSku.' was added', null, 'nChannel_Communicator.log');
|
43 |
+
Mage::log('attachProductToConfigurable: Complete', null, 'nChannel_Communicator.log');
|
44 |
return "Success!";
|
45 |
}
|
46 |
|
package.xml
CHANGED
@@ -1,19 +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>Added
|
12 |
-
Fixed version number.</notes>
|
13 |
<authors><author><name>nChannel</name><user>jpepper</user><email>jpepper@nchannel.com</email></author></authors>
|
14 |
-
<date>2014-09-
|
15 |
-
<time>
|
16 |
-
<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="Helloworld"><dir name="Api"><file name="V2.php" hash="f9c5dd40cee982eeb2c8d6d739e42f9d"/></dir><file name="Api.php" hash="fadb95acd58027f40bca5b9847dc2eda"/></dir><file name="Observer.php" hash="461f9acf6b47d6d53240b4f9ef5b3af3"/><dir name="Productutility"><dir name="Api"><file name="V2.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>5.5.11</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>nChannel_Communicator</name>
|
4 |
+
<version>0.1.11</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 Additional Logging for custom API.</notes>
|
|
|
12 |
<authors><author><name>nChannel</name><user>jpepper</user><email>jpepper@nchannel.com</email></author></authors>
|
13 |
+
<date>2014-09-10</date>
|
14 |
+
<time>15:18:15</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="Helloworld"><dir name="Api"><file name="V2.php" hash="f9c5dd40cee982eeb2c8d6d739e42f9d"/></dir><file name="Api.php" hash="fadb95acd58027f40bca5b9847dc2eda"/></dir><file name="Observer.php" hash="461f9acf6b47d6d53240b4f9ef5b3af3"/><dir name="Productutility"><dir name="Api"><file name="V2.php" hash="68839fe5435efe153f65d75e19ffb995"/></dir><file name="Api.php" hash="83e30c3b4526c851d8ff31dd73957495"/></dir><dir name="Source"><file name="NchannelEnvironment.php" hash="cf979a2ce627f3e20d1d04e55533e89f"/></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="37aef0e17ab515697ac0df19cfb3a1b6"/><file name="config.xml" hash="11ac8090f0a1b735aa3e92cbca9108bf"/><file name="system.xml" hash="19596271befc22620795ae244d6c20b0"/><file name="wsdl.xml" hash="a45680e6ce6e3435aa605645e79aef11"/><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 name="en_US"><dir name="template"><dir name="email"><file name="FailedOrder.html" hash=""/></dir></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>
|