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.6 |
Comparing to | |
See all releases |
Code changes from version 1.5 to 1.6
- app/code/local/Bintime/Icecatimport/Helper/Catalog/Image.php +10 -1
- app/code/local/Bintime/Icecatimport/Helper/Getdata.php +24 -3
- app/code/local/Bintime/Icecatimport/Helper/Image.php +7 -2
- app/code/local/Bintime/Icecatimport/Model/Catalog/Category.php +4 -1
- app/code/local/Bintime/Icecatimport/Model/Catalog/Product.php +5 -3
- app/code/local/Bintime/Icecatimport/Model/Catalog/Search.php +1 -1
- app/code/local/Bintime/Icecatimport/Model/Import.php +87 -53
- app/code/local/Bintime/Icecatimport/Model/Observer.php +58 -16
- app/code/local/Bintime/Icecatimport/Model/System/Config/Attributes.php +2 -2
- app/code/local/Bintime/Icecatimport/Model/System/Config/Locales.php +2 -2
- app/code/local/Bintime/Icecatimport/Model/System/Config/Subscription.php +2 -2
- app/code/local/Bintime/Icecatimport/controllers/ImageController.php +6 -3
- app/code/local/Bintime/Icecatimport/controllers/ProductController.php +14 -2
- app/code/local/Bintime/Icecatimport/etc/config.xml +7 -0
- app/code/local/Bintime/Icecatimport/sql/icecatimport_setup/mysql4-install-0.1.0.php +5 -5
- app/code/local/Bintime/Icecatimport/sql/icecatimport_setup/mysql4-upgrade-0.1.0-0.1.1.php +3 -3
- package.xml +4 -4
app/code/local/Bintime/Icecatimport/Helper/Catalog/Image.php
CHANGED
@@ -1,12 +1,18 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Overloaded catalog helper to substitute magento images
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Helper_Catalog_Image extends Mage_Catalog_Helper_Image
|
8 |
{
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile=null)
|
11 |
{
|
12 |
if ($attributeName == 'image' && $imageFile == null ) {
|
@@ -23,6 +29,9 @@ class Bintime_Icecatimport_Helper_Catalog_Image extends Mage_Catalog_Helper_Imag
|
|
23 |
return parent::init($product, $attributeName, $imageFile);
|
24 |
}
|
25 |
|
|
|
|
|
|
|
26 |
public function __toString()
|
27 |
{
|
28 |
$url = parent::__toString();
|
1 |
<?php
|
2 |
/**
|
3 |
* Overloaded catalog helper to substitute magento images
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Helper_Catalog_Image extends Mage_Catalog_Helper_Image
|
8 |
{
|
9 |
|
10 |
+
/**
|
11 |
+
* Overriden method provides product with images from icecatimport data table
|
12 |
+
* @param $product Mage_Catalog_Model_Product
|
13 |
+
* @param $attributeName string
|
14 |
+
* @param $imageFile string
|
15 |
+
*/
|
16 |
public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile=null)
|
17 |
{
|
18 |
if ($attributeName == 'image' && $imageFile == null ) {
|
29 |
return parent::init($product, $attributeName, $imageFile);
|
30 |
}
|
31 |
|
32 |
+
/**
|
33 |
+
* Return icecat image URL if set
|
34 |
+
*/
|
35 |
public function __toString()
|
36 |
{
|
37 |
$url = parent::__toString();
|
app/code/local/Bintime/Icecatimport/Helper/Getdata.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
*
|
4 |
-
*
|
|
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
|
@@ -10,7 +11,13 @@ class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
|
|
10 |
private $error;
|
11 |
private $systemError;
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
public function getProductDescription($_product){
|
|
|
14 |
$sku = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
|
15 |
$manufacturerId = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
|
16 |
if (Mage::getStoreConfig('icecat_root/icecat/manufacturer') == 'manufacturer'){
|
@@ -33,14 +40,18 @@ class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
|
|
33 |
$userPass = Mage::getStoreConfig('icecat_root/icecat/password');
|
34 |
|
35 |
$this->iceCatModel = Mage::getSingleton('icecatimport/import');
|
36 |
-
|
|
|
37 |
$this->error = $this->iceCatModel->getErrorMessage();
|
38 |
$this->systemError = $this->iceCatModel->getSystemError();
|
39 |
return $this;
|
40 |
}
|
|
|
41 |
return $this;
|
42 |
}
|
43 |
-
|
|
|
|
|
44 |
public function hasError(){
|
45 |
if ($this->error || $this->systemError){
|
46 |
return true;
|
@@ -48,10 +59,16 @@ class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
|
|
48 |
return false;
|
49 |
}
|
50 |
|
|
|
|
|
|
|
51 |
public function getError(){
|
52 |
return $this->error;
|
53 |
}
|
54 |
|
|
|
|
|
|
|
55 |
public function hasSystemError(){
|
56 |
if ($this->systemError){
|
57 |
return $this->systemError;
|
@@ -92,6 +109,10 @@ class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
|
|
92 |
public function getEAN(){
|
93 |
return $this->iceCatModel->getEAN();
|
94 |
}
|
|
|
|
|
|
|
|
|
95 |
public function getRelatedProducts(){
|
96 |
$relatedProducts =$this->iceCatModel->getRelatedProducts();
|
97 |
if (empty($relatedProducts)){
|
1 |
<?php
|
2 |
/**
|
3 |
*
|
4 |
+
* Class achieves icecat description from Model by recieved SKU and manufacturer
|
5 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
6 |
*
|
7 |
*/
|
8 |
class Bintime_Icecatimport_Helper_Getdata extends Mage_Core_Helper_Abstract
|
11 |
private $error;
|
12 |
private $systemError;
|
13 |
|
14 |
+
/**
|
15 |
+
* Gets product Data and delegates it to Model
|
16 |
+
* @param Mage_Catalog_Model_Product $_product
|
17 |
+
* @return Bintime_Icecatimport_Helper_Getdata
|
18 |
+
*/
|
19 |
public function getProductDescription($_product){
|
20 |
+
$entityId = $_product->getEntityId();
|
21 |
$sku = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
|
22 |
$manufacturerId = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
|
23 |
if (Mage::getStoreConfig('icecat_root/icecat/manufacturer') == 'manufacturer'){
|
40 |
$userPass = Mage::getStoreConfig('icecat_root/icecat/password');
|
41 |
|
42 |
$this->iceCatModel = Mage::getSingleton('icecatimport/import');
|
43 |
+
|
44 |
+
if (!$this->iceCatModel->getProductDescription($sku, $manufacturer, $locale, $userLogin, $userPass, $entityId)){
|
45 |
$this->error = $this->iceCatModel->getErrorMessage();
|
46 |
$this->systemError = $this->iceCatModel->getSystemError();
|
47 |
return $this;
|
48 |
}
|
49 |
+
|
50 |
return $this;
|
51 |
}
|
52 |
+
/**
|
53 |
+
* returns true if error during data fetch occured else false
|
54 |
+
*/
|
55 |
public function hasError(){
|
56 |
if ($this->error || $this->systemError){
|
57 |
return true;
|
59 |
return false;
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* return error message
|
64 |
+
*/
|
65 |
public function getError(){
|
66 |
return $this->error;
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* return system error
|
71 |
+
*/
|
72 |
public function hasSystemError(){
|
73 |
if ($this->systemError){
|
74 |
return $this->systemError;
|
109 |
public function getEAN(){
|
110 |
return $this->iceCatModel->getEAN();
|
111 |
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Form related products list according to store products
|
115 |
+
*/
|
116 |
public function getRelatedProducts(){
|
117 |
$relatedProducts =$this->iceCatModel->getRelatedProducts();
|
118 |
if (empty($relatedProducts)){
|
app/code/local/Bintime/Icecatimport/Helper/Image.php
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Helper_Image extends Mage_Core_Helper_Abstract
|
8 |
{
|
|
|
|
|
|
|
|
|
|
|
9 |
public function getImage($_product){
|
10 |
$sku = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
|
11 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class retrieves images from icecatimport data table
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Helper_Image extends Mage_Core_Helper_Abstract
|
8 |
{
|
9 |
+
/**
|
10 |
+
* Fetch Image URL from DB
|
11 |
+
* @param Mage_Catalog_Model_Product $_product
|
12 |
+
* @return string image URL
|
13 |
+
*/
|
14 |
public function getImage($_product){
|
15 |
$sku = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
|
16 |
|
app/code/local/Bintime/Icecatimport/Model/Catalog/Category.php
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* class overrides category getProductCollection function to provide products with needed attributes
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Catalog_Category extends Mage_Catalog_Model_Category
|
8 |
{
|
|
|
|
|
|
|
9 |
public function getProductCollection()
|
10 |
{
|
11 |
$collection = parent::getProductCollection();
|
1 |
<?php
|
2 |
/**
|
3 |
* class overrides category getProductCollection function to provide products with needed attributes
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Catalog_Category extends Mage_Catalog_Model_Category
|
8 |
{
|
9 |
+
/**
|
10 |
+
* add product manufacturer attribute to category collection
|
11 |
+
*/
|
12 |
public function getProductCollection()
|
13 |
{
|
14 |
$collection = parent::getProductCollection();
|
app/code/local/Bintime/Icecatimport/Model/Catalog/Product.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class overrides base Product Model to provide products icecat data
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Catalog_Product extends Mage_Catalog_Model_Product
|
@@ -20,9 +20,11 @@ class Bintime_Icecatimport_Model_Catalog_Product extends Mage_Catalog_Model_Prod
|
|
20 |
else {
|
21 |
$manufacturer = $manufacturerId;
|
22 |
}
|
|
|
|
|
23 |
$selectCondition = $connection->select()->
|
24 |
-
from(array('connector' =>
|
25 |
-
->joinInner(array('supplier' =>
|
26 |
->where('connector.prod_id = ? ', $this->getSku());
|
27 |
$icecatName = $connection->fetchOne($selectCondition);
|
28 |
|
1 |
<?php
|
2 |
/**
|
3 |
* Class overrides base Product Model to provide products icecat data
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Catalog_Product extends Mage_Catalog_Model_Product
|
20 |
else {
|
21 |
$manufacturer = $manufacturerId;
|
22 |
}
|
23 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('icecatimport/data');
|
24 |
+
$mappingTable = Mage::getSingleton('core/resource')->getTableName('icecatimport/supplier_mapping');
|
25 |
$selectCondition = $connection->select()->
|
26 |
+
from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_name'))
|
27 |
+
->joinInner(array('supplier' => $mappingTable), "connector.supplier_id = supplier.supplier_id AND supplier.supplier_symbol = {$connection->quote($manufacturer)}")
|
28 |
->where('connector.prod_id = ? ', $this->getSku());
|
29 |
$icecatName = $connection->fetchOne($selectCondition);
|
30 |
|
app/code/local/Bintime/Icecatimport/Model/Catalog/Search.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* class overrides search getProductCollection function to provide products with needed attributes
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Catalog_Search extends Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
|
1 |
<?php
|
2 |
/**
|
3 |
* class overrides search getProductCollection function to provide products with needed attributes
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Catalog_Search extends Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
|
app/code/local/Bintime/Icecatimport/Model/Import.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
@@ -16,62 +16,75 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
|
16 |
private $productName;
|
17 |
private $relatedProducts = array();
|
18 |
private $errorSystemMessage; //depricated
|
|
|
19 |
|
20 |
protected function _construct()
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$
|
38 |
-
|
39 |
-
}
|
40 |
-
if ( empty($userName)) {
|
41 |
-
$this->errorMessage = "No ICEcat login provided";
|
42 |
-
return false;
|
43 |
-
}
|
44 |
-
if (empty($userPass)){
|
45 |
-
$this->errorMessage = "No ICEcat password provided";
|
46 |
-
return false;
|
47 |
-
}
|
48 |
-
|
49 |
-
$getParamsArray = array("prod_id" => $productId,
|
50 |
-
"lang" =>$locale,
|
51 |
-
"vendor" => $vendorName,
|
52 |
-
"output" =>'productxml'
|
53 |
-
);
|
54 |
-
Varien_Profiler::start('Bintime FILE DOWNLOAD:');
|
55 |
-
try{
|
56 |
-
$webClient = new Zend_Http_Client();
|
57 |
-
$webClient->setUri($dataUrl);
|
58 |
-
$webClient->setMethod(Zend_Http_Client::GET);
|
59 |
-
$webClient->setHeaders('Content-Type: text/xml; charset=UTF-8');
|
60 |
-
$webClient->setParameterGet($getParamsArray);
|
61 |
-
$webClient->setAuth($userName, $userPass, Zend_Http_CLient::AUTH_BASIC);
|
62 |
-
$response = $webClient->request();
|
63 |
-
if ($response->isError()){
|
64 |
-
$this->errorMessage = 'Response Status: '.$response->getStatus()." Response Message: ".$response->getMessage();
|
65 |
return false;
|
66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
-
catch (Exception $e) {
|
69 |
-
$this->errorMessage = "Warning: cannot connect to ICEcat. {$e->getMessage()}";
|
70 |
-
return false;
|
71 |
-
}
|
72 |
-
Varien_Profiler::stop('Bintime FILE DOWNLOAD:');
|
73 |
-
$resultString = $response->getBody();
|
74 |
-
|
75 |
if(!$this->parseXml($resultString)){
|
76 |
return false;
|
77 |
}
|
@@ -102,6 +115,9 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
|
102 |
return $this->galleryPhotos;
|
103 |
}
|
104 |
|
|
|
|
|
|
|
105 |
private function loadGalleryPhotos(){
|
106 |
$galleryPhotos = $this->simpleDoc->Product->ProductGallery->ProductPicture;
|
107 |
if (!count($galleryPhotos)){
|
@@ -126,6 +142,11 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
|
126 |
return $this->errorMessage;
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
129 |
private function checkIcecatResponse($productId, $vendorName){
|
130 |
$errorMessage = $this->simpleDoc->Product['ErrorMessage'];
|
131 |
if ($errorMessage != ''){
|
@@ -176,6 +197,9 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
|
176 |
return $this->EAN;
|
177 |
}
|
178 |
|
|
|
|
|
|
|
179 |
private function loadRelatedProducts(){
|
180 |
$relatedProductsArray = $this->simpleDoc->Product->ProductRelated;
|
181 |
if(count($relatedProductsArray)){
|
@@ -195,6 +219,9 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
|
195 |
}
|
196 |
}
|
197 |
|
|
|
|
|
|
|
198 |
private function loadProductDescriptionList(){
|
199 |
$descriptionArray = array();
|
200 |
|
@@ -218,6 +245,9 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
|
218 |
$this->productDescriptionList = $descriptionArray;
|
219 |
}
|
220 |
|
|
|
|
|
|
|
221 |
private function loadOtherProductParams(){
|
222 |
$this->productDescription = (string) $this->simpleDoc->Product->ProductDescription['ShortDesc'];
|
223 |
$this->fullProductDescription = (string)$this->simpleDoc->Product->ProductDescription['LongDesc'];
|
@@ -230,6 +260,10 @@ class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
|
230 |
$this->EAN = (string)$productTag->EANCode['EAN'];
|
231 |
}
|
232 |
|
|
|
|
|
|
|
|
|
233 |
private function parseXml($stringXml){
|
234 |
libxml_use_internal_errors(true);
|
235 |
$this->simpleDoc = simplexml_load_string($stringXml);
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class performs Curl request to ICEcat and fetches xml data with product description
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Import extends Mage_Core_Model_Abstract {
|
16 |
private $productName;
|
17 |
private $relatedProducts = array();
|
18 |
private $errorSystemMessage; //depricated
|
19 |
+
private $_cacheKey = 'bintime_icecatimport_';
|
20 |
|
21 |
protected function _construct()
|
22 |
+
{
|
23 |
+
$this->_init('icecatimport/import');
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Perform Curl request with corresponding param check and error processing
|
28 |
+
* @param int $productId
|
29 |
+
* @param string $vendorName
|
30 |
+
* @param string $locale
|
31 |
+
* @param string $userName
|
32 |
+
* @param string $userPass
|
33 |
+
*/
|
34 |
+
public function getProductDescription($productId, $vendorName, $locale, $userName, $userPass, $entityId){
|
35 |
+
if (null === $this->simpleDoc) {
|
36 |
+
if (!$cacheDataXml = Mage::app()->getCache()->load($this->_cacheKey . $entityId)) {
|
37 |
+
$dataUrl = 'http://data.icecat.biz/xml_s3/xml_server3.cgi';
|
38 |
+
if (empty($productId)) {
|
39 |
+
$this->errorMessage = 'Given product has no MPN (SKU)';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
return false;
|
41 |
}
|
42 |
+
if (empty($vendorName)){
|
43 |
+
$this->errorMessage = "Given product has no manufacturer specified.";
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
if (empty($locale)) {
|
47 |
+
$this->errorMessage = "Please specify product description locale";
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
if ( empty($userName)) {
|
51 |
+
$this->errorMessage = "No ICEcat login provided";
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
if (empty($userPass)){
|
55 |
+
$this->errorMessage = "No ICEcat password provided";
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
|
59 |
+
$getParamsArray = array("prod_id" => $productId,
|
60 |
+
"lang" =>$locale,
|
61 |
+
"vendor" => $vendorName,
|
62 |
+
"output" =>'productxml'
|
63 |
+
);
|
64 |
+
Varien_Profiler::start('Bintime FILE DOWNLOAD:');
|
65 |
+
try{
|
66 |
+
$webClient = new Zend_Http_Client();
|
67 |
+
$webClient->setUri($dataUrl);
|
68 |
+
$webClient->setMethod(Zend_Http_Client::GET);
|
69 |
+
$webClient->setHeaders('Content-Type: text/xml; charset=UTF-8');
|
70 |
+
$webClient->setParameterGet($getParamsArray);
|
71 |
+
$webClient->setAuth($userName, $userPass, Zend_Http_CLient::AUTH_BASIC);
|
72 |
+
$response = $webClient->request();
|
73 |
+
if ($response->isError()){
|
74 |
+
$this->errorMessage = 'Response Status: '.$response->getStatus()." Response Message: ".$response->getMessage();
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
catch (Exception $e) {
|
79 |
+
$this->errorMessage = "Warning: cannot connect to ICEcat. {$e->getMessage()}";
|
80 |
+
return false;
|
81 |
+
}
|
82 |
+
Varien_Profiler::stop('Bintime FILE DOWNLOAD:');
|
83 |
+
$resultString = $response->getBody();
|
84 |
+
Mage::app()->getCache()->save($resultString, $this->_cacheKey . $entityId);
|
85 |
+
} else {
|
86 |
+
$resultString = $cacheDataXml;
|
87 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
if(!$this->parseXml($resultString)){
|
89 |
return false;
|
90 |
}
|
115 |
return $this->galleryPhotos;
|
116 |
}
|
117 |
|
118 |
+
/**
|
119 |
+
* load Gallery array from XML
|
120 |
+
*/
|
121 |
private function loadGalleryPhotos(){
|
122 |
$galleryPhotos = $this->simpleDoc->Product->ProductGallery->ProductPicture;
|
123 |
if (!count($galleryPhotos)){
|
142 |
return $this->errorMessage;
|
143 |
}
|
144 |
|
145 |
+
/**
|
146 |
+
* Checks response XML for error messages
|
147 |
+
* @param int $productId
|
148 |
+
* @param string $vendorName
|
149 |
+
*/
|
150 |
private function checkIcecatResponse($productId, $vendorName){
|
151 |
$errorMessage = $this->simpleDoc->Product['ErrorMessage'];
|
152 |
if ($errorMessage != ''){
|
197 |
return $this->EAN;
|
198 |
}
|
199 |
|
200 |
+
/**
|
201 |
+
* Form related products Array
|
202 |
+
*/
|
203 |
private function loadRelatedProducts(){
|
204 |
$relatedProductsArray = $this->simpleDoc->Product->ProductRelated;
|
205 |
if(count($relatedProductsArray)){
|
219 |
}
|
220 |
}
|
221 |
|
222 |
+
/**
|
223 |
+
* Form product feature Arrray
|
224 |
+
*/
|
225 |
private function loadProductDescriptionList(){
|
226 |
$descriptionArray = array();
|
227 |
|
245 |
$this->productDescriptionList = $descriptionArray;
|
246 |
}
|
247 |
|
248 |
+
/**
|
249 |
+
* Form Array of non feature-value product params
|
250 |
+
*/
|
251 |
private function loadOtherProductParams(){
|
252 |
$this->productDescription = (string) $this->simpleDoc->Product->ProductDescription['ShortDesc'];
|
253 |
$this->fullProductDescription = (string)$this->simpleDoc->Product->ProductDescription['LongDesc'];
|
260 |
$this->EAN = (string)$productTag->EANCode['EAN'];
|
261 |
}
|
262 |
|
263 |
+
/**
|
264 |
+
* parse response XML: to SimpleXml
|
265 |
+
* @param string $stringXml
|
266 |
+
*/
|
267 |
private function parseXml($stringXml){
|
268 |
libxml_use_internal_errors(true);
|
269 |
$this->simpleDoc = simplexml_load_string($stringXml);
|
app/code/local/Bintime/Icecatimport/Model/Observer.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
3 |
*
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_Observer
|
@@ -17,10 +18,13 @@ class Bintime_Icecatimport_Model_Observer
|
|
17 |
protected $_supplierFile;
|
18 |
|
19 |
protected function _construct()
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
24 |
public function load(){
|
25 |
|
26 |
$loadUrl = $this->getLoadURL();
|
@@ -29,10 +33,10 @@ class Bintime_Icecatimport_Model_Observer
|
|
29 |
try {
|
30 |
$this->_productFile = $this->_prepareFile(basename($loadUrl));
|
31 |
$this->_supplierFile = $this->_prepareFile(basename($this->_supplierMappingUrl));
|
32 |
-
echo "
|
33 |
|
34 |
$this->downloadFile($this->_productFile, $loadUrl);
|
35 |
-
echo "Start of supplier mapping file download";
|
36 |
$this->downloadFile($this->_supplierFile, $this->_supplierMappingUrl);
|
37 |
$this->XMLfile = Mage::getBaseDir('var') . $this->_connectorDir . basename($loadUrl, ".gz");
|
38 |
echo "Start Unzipping Data File<br>";
|
@@ -49,6 +53,10 @@ class Bintime_Icecatimport_Model_Observer
|
|
49 |
}
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
52 |
protected function _parseXml($stringXml){
|
53 |
libxml_use_internal_errors(true);
|
54 |
$simpleDoc = simplexml_load_string($stringXml);
|
@@ -62,24 +70,26 @@ class Bintime_Icecatimport_Model_Observer
|
|
62 |
return false;
|
63 |
}
|
64 |
|
|
|
|
|
|
|
65 |
protected function _loadSupplierListToDb()
|
66 |
{
|
67 |
$connection = $this->getDbConnection();
|
|
|
68 |
try {
|
69 |
$connection->beginTransaction();
|
70 |
-
Mage::log($this->_supplierFile);
|
71 |
$xmlString = file_get_contents($this->_supplierFile);
|
72 |
$xmlDoc = $this->_parseXml($xmlString);
|
73 |
if ($xmlDoc) {
|
74 |
-
$connection->truncate(
|
75 |
$supplierList = $xmlDoc->SupplierMappings->SupplierMapping;
|
76 |
foreach ($supplierList as $supplier) {
|
77 |
$supplierSymbolList = $supplier->Symbol;
|
78 |
$supplierId = $supplier['supplier_id'];
|
79 |
foreach($supplierSymbolList as $symbol) {
|
80 |
-
Mage::log($supplierId . " " . $symbol);
|
81 |
$symbolName = (string)$symbol;
|
82 |
-
$connection->insert(
|
83 |
}
|
84 |
}
|
85 |
$connection->commit();
|
@@ -91,7 +101,9 @@ class Bintime_Icecatimport_Model_Observer
|
|
91 |
throw new Exception("Icecat Import Terminated: {$e->getMessage()}");
|
92 |
}
|
93 |
}
|
94 |
-
|
|
|
|
|
95 |
private function getLoadURL(){
|
96 |
$subscripionLevel = Mage::getStoreConfig('icecat_root/icecat/icecat_type');
|
97 |
if ($subscripionLevel === 'full'){
|
@@ -102,16 +114,27 @@ class Bintime_Icecatimport_Model_Observer
|
|
102 |
}
|
103 |
}
|
104 |
|
|
|
|
|
|
|
105 |
public function getErrorMessage(){
|
106 |
return $this->errorMessage;
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
109 |
public function getImageURL($productSku, $productManufacturer){
|
110 |
$connection = $this->getDbConnection();
|
111 |
try {
|
|
|
|
|
|
|
112 |
$selectCondition = $connection->select()
|
113 |
-
->from(array('connector' =>
|
114 |
-
->joinInner(array('supplier' =>
|
115 |
->where('connector.prod_id = ? ', $productSku);
|
116 |
$imageURL = $connection->fetchOne($selectCondition);
|
117 |
if (empty($imageURL)){
|
@@ -125,6 +148,9 @@ class Bintime_Icecatimport_Model_Observer
|
|
125 |
}
|
126 |
}
|
127 |
|
|
|
|
|
|
|
128 |
private function getDbConnection(){
|
129 |
if ($this->connection){
|
130 |
return $this->connection;
|
@@ -133,19 +159,23 @@ class Bintime_Icecatimport_Model_Observer
|
|
133 |
return $this->connection;
|
134 |
}
|
135 |
|
|
|
|
|
|
|
136 |
private function loadFileToDb(){
|
137 |
$connection = $this->getDbConnection();
|
|
|
138 |
try {
|
139 |
$connection->beginTransaction();
|
140 |
$fileHandler = fopen($this->XMLfile, "r");
|
141 |
if ($fileHandler) {
|
142 |
-
$connection->truncate(
|
143 |
while (!feof($fileHandler)) {
|
144 |
$row = fgets($fileHandler);
|
145 |
$oneLine = explode("\t", $row);
|
146 |
if ($oneLine[0]!= 'product_id' && $oneLine[0]!= ''){
|
147 |
try{
|
148 |
-
$connection->insert(
|
149 |
}
|
150 |
catch(Exception $e){
|
151 |
Mage::log("connector issue: {$e->getMessage()}");
|
@@ -161,6 +191,9 @@ class Bintime_Icecatimport_Model_Observer
|
|
161 |
}
|
162 |
}
|
163 |
|
|
|
|
|
|
|
164 |
private function unzipFile(){
|
165 |
$gz = gzopen ( $this->_productFile, 'rb' );
|
166 |
|
@@ -183,6 +216,11 @@ class Bintime_Icecatimport_Model_Observer
|
|
183 |
fclose($fileToWrite);
|
184 |
}
|
185 |
|
|
|
|
|
|
|
|
|
|
|
186 |
private function downloadFile($destinationFile, $loadUrl){
|
187 |
$userName = Mage::getStoreConfig('icecat_root/icecat/login');
|
188 |
$userPass = Mage::getStoreConfig('icecat_root/icecat/password');
|
@@ -207,6 +245,10 @@ class Bintime_Icecatimport_Model_Observer
|
|
207 |
fclose($fileToWrite);
|
208 |
}
|
209 |
|
|
|
|
|
|
|
|
|
210 |
protected function _prepareFile($fileName){
|
211 |
$varDir = Mage::getBaseDir('var') . $this->_connectorDir;
|
212 |
$filePath = $varDir . $fileName;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class provides category page with images, cron processing
|
4 |
*
|
5 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
6 |
*
|
7 |
*/
|
8 |
class Bintime_Icecatimport_Model_Observer
|
18 |
protected $_supplierFile;
|
19 |
|
20 |
protected function _construct()
|
21 |
+
{
|
22 |
+
$this->_init('icecatimport/observer');
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* root method for uploading images to DB
|
27 |
+
*/
|
28 |
public function load(){
|
29 |
|
30 |
$loadUrl = $this->getLoadURL();
|
33 |
try {
|
34 |
$this->_productFile = $this->_prepareFile(basename($loadUrl));
|
35 |
$this->_supplierFile = $this->_prepareFile(basename($this->_supplierMappingUrl));
|
36 |
+
echo "Data file downloading started <br>";
|
37 |
|
38 |
$this->downloadFile($this->_productFile, $loadUrl);
|
39 |
+
echo "Start of supplier mapping file download<br>";
|
40 |
$this->downloadFile($this->_supplierFile, $this->_supplierMappingUrl);
|
41 |
$this->XMLfile = Mage::getBaseDir('var') . $this->_connectorDir . basename($loadUrl, ".gz");
|
42 |
echo "Start Unzipping Data File<br>";
|
53 |
}
|
54 |
}
|
55 |
|
56 |
+
/**
|
57 |
+
* parse given XML to SIMPLE XML
|
58 |
+
* @param string $stringXml
|
59 |
+
*/
|
60 |
protected function _parseXml($stringXml){
|
61 |
libxml_use_internal_errors(true);
|
62 |
$simpleDoc = simplexml_load_string($stringXml);
|
70 |
return false;
|
71 |
}
|
72 |
|
73 |
+
/**
|
74 |
+
* Upload supplier mapping list to Database
|
75 |
+
*/
|
76 |
protected function _loadSupplierListToDb()
|
77 |
{
|
78 |
$connection = $this->getDbConnection();
|
79 |
+
$mappingTable = Mage::getSingleton('core/resource')->getTableName('icecatimport/supplier_mapping');
|
80 |
try {
|
81 |
$connection->beginTransaction();
|
|
|
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();
|
101 |
throw new Exception("Icecat Import Terminated: {$e->getMessage()}");
|
102 |
}
|
103 |
}
|
104 |
+
/**
|
105 |
+
* retrieve URL of data file that corresponds ICEcat account
|
106 |
+
*/
|
107 |
private function getLoadURL(){
|
108 |
$subscripionLevel = Mage::getStoreConfig('icecat_root/icecat/icecat_type');
|
109 |
if ($subscripionLevel === 'full'){
|
114 |
}
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
* return error messages
|
119 |
+
*/
|
120 |
public function getErrorMessage(){
|
121 |
return $this->errorMessage;
|
122 |
}
|
123 |
|
124 |
+
/**
|
125 |
+
* getImage URL from DB
|
126 |
+
* @param string $productSku
|
127 |
+
* @param string $productManufacturer
|
128 |
+
*/
|
129 |
public function getImageURL($productSku, $productManufacturer){
|
130 |
$connection = $this->getDbConnection();
|
131 |
try {
|
132 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('icecatimport/data');
|
133 |
+
$mappingTable = Mage::getSingleton('core/resource')->getTableName('icecatimport/supplier_mapping');
|
134 |
+
|
135 |
$selectCondition = $connection->select()
|
136 |
+
->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_img'))
|
137 |
+
->joinInner(array('supplier' => $mappingTable), "connector.supplier_id = supplier.supplier_id AND supplier.supplier_symbol = {$this->connection->quote($productManufacturer)}")
|
138 |
->where('connector.prod_id = ? ', $productSku);
|
139 |
$imageURL = $connection->fetchOne($selectCondition);
|
140 |
if (empty($imageURL)){
|
148 |
}
|
149 |
}
|
150 |
|
151 |
+
/**
|
152 |
+
* Singletong for DB connection
|
153 |
+
*/
|
154 |
private function getDbConnection(){
|
155 |
if ($this->connection){
|
156 |
return $this->connection;
|
159 |
return $this->connection;
|
160 |
}
|
161 |
|
162 |
+
/**
|
163 |
+
* Upload Data file to DP
|
164 |
+
*/
|
165 |
private function loadFileToDb(){
|
166 |
$connection = $this->getDbConnection();
|
167 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('icecatimport/data');
|
168 |
try {
|
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()}");
|
191 |
}
|
192 |
}
|
193 |
|
194 |
+
/**
|
195 |
+
* unzip Uploaded file
|
196 |
+
*/
|
197 |
private function unzipFile(){
|
198 |
$gz = gzopen ( $this->_productFile, 'rb' );
|
199 |
|
216 |
fclose($fileToWrite);
|
217 |
}
|
218 |
|
219 |
+
/**
|
220 |
+
* Process downloading files
|
221 |
+
* @param string $destinationFile
|
222 |
+
* @param string $loadUrl
|
223 |
+
*/
|
224 |
private function downloadFile($destinationFile, $loadUrl){
|
225 |
$userName = Mage::getStoreConfig('icecat_root/icecat/login');
|
226 |
$userPass = Mage::getStoreConfig('icecat_root/icecat/password');
|
245 |
fclose($fileToWrite);
|
246 |
}
|
247 |
|
248 |
+
/**
|
249 |
+
* Prepares file and folder for futur download
|
250 |
+
* @param string $fileName
|
251 |
+
*/
|
252 |
protected function _prepareFile($fileName){
|
253 |
$varDir = Mage::getBaseDir('var') . $this->_connectorDir;
|
254 |
$filePath = $varDir . $fileName;
|
app/code/local/Bintime/Icecatimport/Model/System/Config/Attributes.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_System_Config_Attributes
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class Provides product Attributes for BO menu
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_System_Config_Attributes
|
app/code/local/Bintime/Icecatimport/Model/System/Config/Locales.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_System_Config_Locales
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class Provides locales list for Magento BO
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_System_Config_Locales
|
app/code/local/Bintime/Icecatimport/Model/System/Config/Subscription.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_System_Config_Subscription
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class provides data for Magento BO
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
class Bintime_Icecatimport_Model_System_Config_Subscription
|
app/code/local/Bintime/Icecatimport/controllers/ImageController.php
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* @author Sergey Gozhedrianov <
|
5 |
*
|
6 |
*/
|
7 |
-
class Bintime_Icecatimport_ImageController extends
|
8 |
|
|
|
|
|
|
|
9 |
public function viewAction(){
|
10 |
$result = Mage::getModel('icecatimport/observer')->load();
|
11 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class provides controller for import image debug
|
4 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
5 |
*
|
6 |
*/
|
7 |
+
class Bintime_Icecatimport_ImageController extends Mage_Adminhtml_Controller_Action{
|
8 |
|
9 |
+
/**
|
10 |
+
* Action calls load method which uploads data to bintime connector data table
|
11 |
+
*/
|
12 |
public function viewAction(){
|
13 |
$result = Mage::getModel('icecatimport/observer')->load();
|
14 |
}
|
app/code/local/Bintime/Icecatimport/controllers/ProductController.php
CHANGED
@@ -1,26 +1,38 @@
|
|
1 |
<?php
|
2 |
require_once 'Mage/Catalog/controllers/ProductController.php';
|
3 |
/**
|
4 |
-
*
|
5 |
-
* @author Sergey Gozhedrianov <
|
6 |
*
|
7 |
*/
|
8 |
class Bintime_Icecatimport_ProductController extends Mage_Catalog_ProductController{
|
|
|
|
|
|
|
9 |
public function viewAction(){
|
10 |
parent::viewAction();
|
11 |
}
|
12 |
|
|
|
|
|
|
|
13 |
public function galleryAction(){
|
14 |
$this->getRequest()->setRouteName('catalog');
|
15 |
parent::galleryAction();
|
16 |
}
|
17 |
|
|
|
|
|
|
|
18 |
public function imageAction()
|
19 |
{
|
20 |
$this->getRequest()->setRouteName('catalog');
|
21 |
parent::imageAction();
|
22 |
}
|
23 |
|
|
|
|
|
|
|
24 |
public function preDispatch()
|
25 |
{
|
26 |
parent::preDispatch();
|
1 |
<?php
|
2 |
require_once 'Mage/Catalog/controllers/ProductController.php';
|
3 |
/**
|
4 |
+
* Class rewrites standard product view controller to provide icecat data on the page
|
5 |
+
* @author Sergey Gozhedrianov <info@bintime.com>
|
6 |
*
|
7 |
*/
|
8 |
class Bintime_Icecatimport_ProductController extends Mage_Catalog_ProductController{
|
9 |
+
/**
|
10 |
+
* parent view Action
|
11 |
+
*/
|
12 |
public function viewAction(){
|
13 |
parent::viewAction();
|
14 |
}
|
15 |
|
16 |
+
/**
|
17 |
+
* parent gallery Action
|
18 |
+
*/
|
19 |
public function galleryAction(){
|
20 |
$this->getRequest()->setRouteName('catalog');
|
21 |
parent::galleryAction();
|
22 |
}
|
23 |
|
24 |
+
/**
|
25 |
+
* parent Image Action
|
26 |
+
*/
|
27 |
public function imageAction()
|
28 |
{
|
29 |
$this->getRequest()->setRouteName('catalog');
|
30 |
parent::imageAction();
|
31 |
}
|
32 |
|
33 |
+
/**
|
34 |
+
* before resolving url make sure that route name is correct
|
35 |
+
*/
|
36 |
public function preDispatch()
|
37 |
{
|
38 |
parent::preDispatch();
|
app/code/local/Bintime/Icecatimport/etc/config.xml
CHANGED
@@ -19,7 +19,14 @@
|
|
19 |
<models>
|
20 |
<icecatimport>
|
21 |
<class>Bintime_Icecatimport_Model</class>
|
|
|
22 |
</icecatimport>
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<catalog>
|
24 |
<rewrite>
|
25 |
<product>Bintime_Icecatimport_Model_Catalog_Product</product>
|
19 |
<models>
|
20 |
<icecatimport>
|
21 |
<class>Bintime_Icecatimport_Model</class>
|
22 |
+
<resourceModel>icecatimport_resource_eav_mysql4</resourceModel>
|
23 |
</icecatimport>
|
24 |
+
<icecatimport_resource_eav_mysql4>
|
25 |
+
<entities>
|
26 |
+
<data><table>bintime_connector_data</table></data>
|
27 |
+
<supplier_mapping><table>bintime_supplier_mapping</table></supplier_mapping>
|
28 |
+
</entities>
|
29 |
+
</icecatimport_resource_eav_mysql4>
|
30 |
<catalog>
|
31 |
<rewrite>
|
32 |
<product>Bintime_Icecatimport_Model_Catalog_Product</product>
|
app/code/local/Bintime/Icecatimport/sql/icecatimport_setup/mysql4-install-0.1.0.php
CHANGED
@@ -5,19 +5,19 @@ $installer = $this;
|
|
5 |
$installer->startSetup();
|
6 |
|
7 |
$installer->run("
|
8 |
-
DROP TABLE IF EXISTS
|
9 |
-
CREATE TABLE {$this->getTable('
|
10 |
`prod_id` varchar(255) NOT NULL,
|
11 |
`prod_img` varchar(255),
|
12 |
KEY `PRODUCT_MPN` (`prod_id`)
|
13 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Bintime Connector product image table';
|
14 |
|
15 |
-
DROP TABLE IF EXISTS
|
16 |
-
CREATE TABLE {$this->getTable('
|
17 |
`supplier_id` int(11) NOT NULL,
|
18 |
`supplier_symbol` VARCHAR(255),
|
19 |
KEY `supplier_id` (`supplier_id`)
|
20 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Bintime Connector
|
21 |
|
22 |
");
|
23 |
$installer->endSetup();
|
5 |
$installer->startSetup();
|
6 |
|
7 |
$installer->run("
|
8 |
+
DROP TABLE IF EXISTS {$this->getTable('icecatimport/data')};
|
9 |
+
CREATE TABLE {$this->getTable('icecatimport/data')} (
|
10 |
`prod_id` varchar(255) NOT NULL,
|
11 |
`prod_img` varchar(255),
|
12 |
KEY `PRODUCT_MPN` (`prod_id`)
|
13 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Bintime Connector product image table';
|
14 |
|
15 |
+
DROP TABLE IF EXISTS {$this->getTable('icecatimport/supplier_mapping')};
|
16 |
+
CREATE TABLE {$this->getTable('icecatimport/supplier_mapping')} (
|
17 |
`supplier_id` int(11) NOT NULL,
|
18 |
`supplier_symbol` VARCHAR(255),
|
19 |
KEY `supplier_id` (`supplier_id`)
|
20 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Bintime Connector supplier mapping table';
|
21 |
|
22 |
");
|
23 |
$installer->endSetup();
|
app/code/local/Bintime/Icecatimport/sql/icecatimport_setup/mysql4-upgrade-0.1.0-0.1.1.php
CHANGED
@@ -4,9 +4,9 @@ $installer = $this;
|
|
4 |
|
5 |
$installer->startSetup();
|
6 |
$installer->run("
|
7 |
-
ALTER TABLE {$this->getTable('
|
8 |
-
ALTER TABLE {$this->getTable('
|
9 |
-
ALTER TABLE {$this->getTable('
|
10 |
");
|
11 |
$installer->endSetup();
|
12 |
?>
|
4 |
|
5 |
$installer->startSetup();
|
6 |
$installer->run("
|
7 |
+
ALTER TABLE {$this->getTable('icecatimport/data')} ADD COLUMN `prod_name` VARCHAR(255) AFTER `prod_id`;
|
8 |
+
ALTER TABLE {$this->getTable('icecatimport/data')} ADD COLUMN `supplier_id` int(11) AFTER `prod_id`;
|
9 |
+
ALTER TABLE {$this->getTable('icecatimport/data')} ADD KEY `supplier_id` (`supplier_id`);
|
10 |
");
|
11 |
$installer->endSetup();
|
12 |
?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MageConnector</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -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-
|
22 |
-
<time>
|
23 |
-
<contents><target name="magelocal"><dir name="Bintime"><dir name="Icecatimport"><dir name="controllers"><file name="ImageController.php" hash="
|
24 |
<compatible/>
|
25 |
<dependencies/>
|
26 |
</package>
|
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>
|
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>
|