MageConnector - Version 1.7

Version Notes

In case of bugs\errors while dowmloading, please report them to marina@bintime.com

Download this release

Release Info

Developer Magento Core Team
Extension MageConnector
Version 1.7
Comparing to
See all releases


Code changes from version 1.6 to 1.7

app/code/local/Bintime/Icecatimport/Helper/Getdata.php CHANGED
@@ -63,7 +63,7 @@ class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
63
  * return error message
64
  */
65
  public function getError(){
66
- return $this->error;
67
  }
68
 
69
  /**
@@ -171,4 +171,4 @@ class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
171
  return $relatedProductsList;
172
  }
173
  }
174
- ?>
63
  * return error message
64
  */
65
  public function getError(){
66
+ //show icecat error on product page return $this->error;
67
  }
68
 
69
  /**
171
  return $relatedProductsList;
172
  }
173
  }
174
+ ?>
app/code/local/Bintime/Icecatimport/Model/Import.php CHANGED
@@ -257,7 +257,14 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
257
  $this->productName = (string)$productTag["Name"];
258
  $this->productId = (string)$productTag['Prod_id'];
259
  $this->vendor = (string)$productTag->Supplier['Name'];
260
- $this->EAN = (string)$productTag->EANCode['EAN'];
 
 
 
 
 
 
 
261
  }
262
 
263
  /**
@@ -277,4 +284,4 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
277
  return false;
278
  }
279
  }
280
- ?>
257
  $this->productName = (string)$productTag["Name"];
258
  $this->productId = (string)$productTag['Prod_id'];
259
  $this->vendor = (string)$productTag->Supplier['Name'];
260
+ $prodEAN = $productTag->EANCode;
261
+ $EANstr='';
262
+ $EANarr=null;
263
+ foreach($prodEAN as $ellEAN){
264
+ $EANarr[]=$ellEAN['EAN'];
265
+ }
266
+ $EANstr=implode(",",$EANarr);
267
+ $this->EAN = (string)$EANstr;//$productTag->EANCode['EAN'];
268
  }
269
 
270
  /**
284
  return false;
285
  }
286
  }
287
+ ?>
app/code/local/Bintime/Icecatimport/Model/Observer.php CHANGED
@@ -82,16 +82,28 @@ class Bintime_Icecatimport_Model_Observer
82
  $xmlString = file_get_contents($this->_supplierFile);
83
  $xmlDoc = $this->_parseXml($xmlString);
84
  if ($xmlDoc) {
85
- $connection->truncate($mappingTable);
 
 
 
 
 
 
 
 
86
  $supplierList = $xmlDoc->SupplierMappings->SupplierMapping;
87
  foreach ($supplierList as $supplier) {
88
  $supplierSymbolList = $supplier->Symbol;
89
  $supplierId = $supplier['supplier_id'];
90
  foreach($supplierSymbolList as $symbol) {
91
  $symbolName = (string)$symbol;
92
- $connection->insert($mappingTable, array('supplier_id' => $supplierId, 'supplier_symbol' => $symbolName));
93
  }
94
  }
 
 
 
 
95
  $connection->commit();
96
  } else {
97
  throw new Exception('Unable to process supplier file');
@@ -169,19 +181,36 @@ class Bintime_Icecatimport_Model_Observer
169
  $connection->beginTransaction();
170
  $fileHandler = fopen($this->XMLfile, "r");
171
  if ($fileHandler) {
172
- $connection->truncate($tableName);
 
 
 
 
 
 
 
 
 
 
173
  while (!feof($fileHandler)) {
174
  $row = fgets($fileHandler);
175
  $oneLine = explode("\t", $row);
176
  if ($oneLine[0]!= 'product_id' && $oneLine[0]!= ''){
177
  try{
178
- $connection->insert($tableName, array('prod_id' => $oneLine[1], 'prod_img' => $oneLine[6], 'prod_name' => $oneLine[12], 'supplier_id' => $oneLine[13]));
 
179
  }
 
180
  catch(Exception $e){
181
  Mage::log("connector issue: {$e->getMessage()}");
182
  }
 
183
  }
184
  }
 
 
 
 
185
  $connection->commit();
186
  fclose($fileHandler);
187
  }
@@ -263,4 +292,4 @@ class Bintime_Icecatimport_Model_Observer
263
  return $filePath;
264
  }
265
  }
266
- ?>
82
  $xmlString = file_get_contents($this->_supplierFile);
83
  $xmlDoc = $this->_parseXml($xmlString);
84
  if ($xmlDoc) {
85
+ $connection->query("DROP TABLE IF EXISTS `".$mappingTable."_temp`");
86
+ $connection->query("
87
+ CREATE TABLE `".$mappingTable."_temp` (
88
+ `supplier_id` int(11) NOT NULL,
89
+ `supplier_symbol` varchar(255) DEFAULT NULL,
90
+ KEY `supplier_id` (`supplier_id`)
91
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
92
+ ");
93
+
94
  $supplierList = $xmlDoc->SupplierMappings->SupplierMapping;
95
  foreach ($supplierList as $supplier) {
96
  $supplierSymbolList = $supplier->Symbol;
97
  $supplierId = $supplier['supplier_id'];
98
  foreach($supplierSymbolList as $symbol) {
99
  $symbolName = (string)$symbol;
100
+ $connection->insert($mappingTable."_temp", array('supplier_id' => $supplierId, 'supplier_symbol' => $symbolName));
101
  }
102
  }
103
+
104
+ $connection->query("DROP TABLE IF EXISTS `".$mappingTable."_old`");
105
+ $connection->query("rename table `".$mappingTable."` to `".$mappingTable."_old`, `".$mappingTable."_temp` to ".$mappingTable);
106
+
107
  $connection->commit();
108
  } else {
109
  throw new Exception('Unable to process supplier file');
181
  $connection->beginTransaction();
182
  $fileHandler = fopen($this->XMLfile, "r");
183
  if ($fileHandler) {
184
+ $connection->query("DROP TABLE IF EXISTS `".$tableName."_temp`");
185
+ $connection->query("
186
+ CREATE TABLE `".$tableName."_temp` (
187
+ `prod_id` varchar(255) NOT NULL,
188
+ `supplier_id` int(11) DEFAULT NULL,
189
+ `prod_name` varchar(255) DEFAULT NULL,
190
+ `prod_img` varchar(255) DEFAULT NULL,
191
+ KEY `PRODUCT_MPN` (`prod_id`),
192
+ KEY `supplier_id` (`supplier_id`)
193
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
194
+ ");
195
  while (!feof($fileHandler)) {
196
  $row = fgets($fileHandler);
197
  $oneLine = explode("\t", $row);
198
  if ($oneLine[0]!= 'product_id' && $oneLine[0]!= ''){
199
  try{
200
+ $connection->insert($tableName."_temp", array('prod_id' => $oneLine[1], 'prod_img' => $oneLine[6], 'prod_name' => $oneLine[12], 'supplier_id' => $oneLine[13]));
201
+
202
  }
203
+
204
  catch(Exception $e){
205
  Mage::log("connector issue: {$e->getMessage()}");
206
  }
207
+
208
  }
209
  }
210
+ $connection->query("DROP TABLE IF EXISTS `".$tableName."_old`");
211
+ $connection->query("rename table `".$tableName."` to `".$tableName."_old`, `".$tableName."_temp` to ".$tableName);
212
+
213
+
214
  $connection->commit();
215
  fclose($fileHandler);
216
  }
292
  return $filePath;
293
  }
294
  }
295
+ ?>
package.xml CHANGED
@@ -1,13 +1,13 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MageConnector</name>
4
- <version>1.6</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ICEcat to Magento Open Source Connector - rich content in your magento shop</summary>
10
- <description>bInTime has released a free &amp; open-source ICEcat connector to Magento - MageConnector
11
 
12
  MageConnector will provide you with:
13
 
@@ -18,9 +18,9 @@ MageConnector will provide you with:
18
  Data presented on datasheets, are taken from Open ICEcat in a real-time and rendered immediately.</description>
19
  <notes>In case of bugs\errors while dowmloading, please report them to marina@bintime.com</notes>
20
  <authors><author><name>bInTime</name><user>auto-converted</user><email>info@bintime.com</email></author></authors>
21
- <date>2010-06-21</date>
22
- <time>13:34:07</time>
23
- <contents><target name="magelocal"><dir name="Bintime"><dir name="Icecatimport"><dir name="controllers"><file name="ImageController.php" hash="cdf4984c268346088729831b7abdf026"/><file name="ProductController.php" hash="92c91fe0c165a4785e1c0e218f0f16e7"/></dir><dir name="etc"><file name="config.xml" hash="795143b35cc3c1acbc2172858310ddfd"/><file name="system.xml" hash="ae2e088315ad42f3f4407d897a742323"/></dir><dir name="Helper"><dir name="Catalog"><file name="Image.php" hash="d74c2094fc1daae658f2031e55f0a2ca"/></dir><file name="Getdata.php" hash="280c9d863ca2fdbf8ff0509c010fde6f"/><file name="Image.php" hash="1a979cf3e39a39672929c1b8f042e445"/></dir><dir name="Model"><dir name="Catalog"><file name="Category.php" hash="21abeb7a7c2c85db8ce4d2f4ed203f50"/><file name="Product.php" hash="895cafda0d7a1c2304d80e6f0a993084"/><file name="Search.php" hash="99c7eb706e67e01ea8167ebe88fe72d9"/></dir><dir name="System"><dir name="Config"><file name="Attributes.php" hash="23284e0d38677b4544fc87642a6bc8b5"/><file name="LanguageList.xml" hash="391ef56fab212879709780df5a7710e7"/><file name="Locales.php" hash="d72813a472ad555f21248f7b3e5e67d5"/><file name="Subscription.php" hash="db2d782d32830e88fbe2cc87beaebfa3"/></dir></dir><file name="Import.php" hash="431af162bdb9d876670182e703924ff7"/><file name="Observer.php" hash="fc4a227d7b005e75f0530ab7f75a2376"/></dir><dir name="sql"><dir name="icecatimport_setup"><file name="mysql4-install-0.1.0.php" hash="a8f750e7667f8ef0dd077100c9fddf48"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="c0581c5b00420492714bd7e3cc66cb6d"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Bintime_Icecatimport.csv" hash="446a70e5bfc60e4e5429de9993697430"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="view_table.css" hash="74eb11cf62d05141d250c933a26cfd0a"/></dir><dir name="js"><file name="product_view.js" hash="d308b475fd6c5dd0ec8ce91a73bb9560"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="icecatimport.xml" hash="2ba9d48105f1f319e097558dc4db88fa"/></dir><dir name="template"><dir name="icecatimport"><file name="media.phtml" hash="ecd0486333a824af2eb9b2b70def14ad"/><file name="view.phtml" hash="36fb6f04ef842359eb27d6fce4e740ce"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bintime_Icecatimport.xml" hash="42e88c21f93cac8ba3185cfdda115b75"/></dir></target></contents>
24
  <compatible/>
25
  <dependencies/>
26
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MageConnector</name>
4
+ <version>1.7</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ICEcat to Magento Open Source Connector - rich content in your magento shop</summary>
10
+ <description>bInTime has released a free &amp;amp; open-source ICEcat connector to Magento - MageConnector
11
 
12
  MageConnector will provide you with:
13
 
18
  Data presented on datasheets, are taken from Open ICEcat in a real-time and rendered immediately.</description>
19
  <notes>In case of bugs\errors while dowmloading, please report them to marina@bintime.com</notes>
20
  <authors><author><name>bInTime</name><user>auto-converted</user><email>info@bintime.com</email></author></authors>
21
+ <date>2010-09-14</date>
22
+ <time>15:05:43</time>
23
+ <contents><target name="magelocal"><dir name="Bintime"><dir name="Icecatimport"><dir name="controllers"><file name="ImageController.php" hash="cdf4984c268346088729831b7abdf026"/><file name="ProductController.php" hash="92c91fe0c165a4785e1c0e218f0f16e7"/></dir><dir name="etc"><file name="config.xml" hash="795143b35cc3c1acbc2172858310ddfd"/><file name="system.xml" hash="ae2e088315ad42f3f4407d897a742323"/></dir><dir name="Helper"><dir name="Catalog"><file name="Image.php" hash="d74c2094fc1daae658f2031e55f0a2ca"/></dir><file name="Getdata.php" hash="0a8f07e9391f1eb16574e072f350df22"/><file name="Image.php" hash="1a979cf3e39a39672929c1b8f042e445"/></dir><dir name="Model"><dir name="Catalog"><file name="Category.php" hash="21abeb7a7c2c85db8ce4d2f4ed203f50"/><file name="Product.php" hash="895cafda0d7a1c2304d80e6f0a993084"/><file name="Search.php" hash="99c7eb706e67e01ea8167ebe88fe72d9"/></dir><dir name="System"><dir name="Config"><file name="Attributes.php" hash="23284e0d38677b4544fc87642a6bc8b5"/><file name="LanguageList.xml" hash="391ef56fab212879709780df5a7710e7"/><file name="Locales.php" hash="d72813a472ad555f21248f7b3e5e67d5"/><file name="Subscription.php" hash="db2d782d32830e88fbe2cc87beaebfa3"/></dir></dir><file name="Import.php" hash="3dc32c70a625e92b94d9ec8342046b8f"/><file name="Observer.php" hash="c9a23c881a7c32cf315f851466eb00ae"/></dir><dir name="sql"><dir name="icecatimport_setup"><file name="mysql4-install-0.1.0.php" hash="a8f750e7667f8ef0dd077100c9fddf48"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="c0581c5b00420492714bd7e3cc66cb6d"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Bintime_Icecatimport.csv" hash="446a70e5bfc60e4e5429de9993697430"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="view_table.css" hash="74eb11cf62d05141d250c933a26cfd0a"/></dir><dir name="js"><file name="product_view.js" hash="d308b475fd6c5dd0ec8ce91a73bb9560"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="icecatimport.xml" hash="2ba9d48105f1f319e097558dc4db88fa"/></dir><dir name="template"><dir name="icecatimport"><file name="media.phtml" hash="ecd0486333a824af2eb9b2b70def14ad"/><file name="view.phtml" hash="36fb6f04ef842359eb27d6fce4e740ce"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bintime_Icecatimport.xml" hash="42e88c21f93cac8ba3185cfdda115b75"/></dir></target></contents>
24
  <compatible/>
25
  <dependencies/>
26
  </package>