Version Notes
Improvements:
- Problem detection mechanism
Bugfix:
- Minor bug fixing
Download this release
Release Info
Developer | IceShop |
Extension | IcecatLive |
Version | 1.7.4 |
Comparing to | |
See all releases |
Code changes from version 1.7.3 to 1.7.4
- app/code/local/Iceshop/Icecatlive/Helper/System/Systemcheck.php +11 -5
- app/code/local/Iceshop/Icecatlive/Model/Import.php +149 -78
- app/code/local/Iceshop/Icecatlive/Model/Observer.php +51 -22
- app/code/local/Iceshop/Icecatlive/etc/config.xml +1 -1
- app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/{mysql4-install-1.7.3.php → mysql4-install-1.7.4.php} +9 -3
- app/design/adminhtml/default/default/template/iceshop/icecatlive/ajaxstatusimport.phtml +6 -0
- package.xml +4 -4
app/code/local/Iceshop/Icecatlive/Helper/System/Systemcheck.php
CHANGED
@@ -565,15 +565,21 @@ class Iceshop_Icecatlive_Helper_System_Systemcheck extends Mage_Core_Helper_Abst
|
|
565 |
$problems['extension']['permission_error'][] = ''. Mage::getBaseDir('var') . ''.Mage::getConfig()->getNode('default/icecatlive/icecatlive_cache_path')->cache_path;
|
566 |
$count++;
|
567 |
}
|
|
|
|
|
|
|
|
|
568 |
if (!$check_module['path_exists']) {
|
569 |
-
|
570 |
$problems['extension']['path_exists'][] = $check_module['path'];
|
571 |
-
|
|
|
572 |
}
|
573 |
if (!$check_module['config_exists']) {
|
574 |
-
|
575 |
-
|
576 |
-
|
|
|
577 |
}
|
578 |
//extension rewrites problems
|
579 |
$check_rewrites = $this->getRewriteCollection('Iceshop_Icecatlive');
|
565 |
$problems['extension']['permission_error'][] = ''. Mage::getBaseDir('var') . ''.Mage::getConfig()->getNode('default/icecatlive/icecatlive_cache_path')->cache_path;
|
566 |
$count++;
|
567 |
}
|
568 |
+
if(!is_writable(Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath() . '/')){
|
569 |
+
$problems['extension']['permission_error'][] = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath() . '/';
|
570 |
+
$count++;
|
571 |
+
}
|
572 |
if (!$check_module['path_exists']) {
|
573 |
+
if(!empty($check_module['path'])){
|
574 |
$problems['extension']['path_exists'][] = $check_module['path'];
|
575 |
+
$count++;
|
576 |
+
}
|
577 |
}
|
578 |
if (!$check_module['config_exists']) {
|
579 |
+
if(!empty($check_module['path'])){
|
580 |
+
$problems['extension']['config_exists'][] = $check_module['path'] . '/etc/config.xml';
|
581 |
+
$count++;
|
582 |
+
}
|
583 |
}
|
584 |
//extension rewrites problems
|
585 |
$check_rewrites = $this->getRewriteCollection('Iceshop_Icecatlive');
|
app/code/local/Iceshop/Icecatlive/Model/Import.php
CHANGED
@@ -148,8 +148,6 @@ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
|
|
148 |
}
|
149 |
}
|
150 |
|
151 |
-
|
152 |
-
|
153 |
public function _saveProductCatalogImage($entityId, $productTag){
|
154 |
$Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
|
155 |
if ($Imagepriority != 'Db') {
|
@@ -163,9 +161,14 @@ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
|
|
163 |
}
|
164 |
}
|
165 |
|
|
|
|
|
|
|
|
|
|
|
166 |
public function changeHostsImages($productTag){
|
167 |
-
|
168 |
-
|
169 |
}
|
170 |
|
171 |
public function getErrorMessage()
|
@@ -413,6 +416,7 @@ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
|
|
413 |
*/
|
414 |
public function saveImg($productId, $img_url, $img_type = '')
|
415 |
{
|
|
|
416 |
$pathinfo = pathinfo($img_url);
|
417 |
if(!empty($pathinfo["extension"])){
|
418 |
$img_type = $pathinfo["extension"];
|
@@ -440,7 +444,7 @@ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
|
|
440 |
}
|
441 |
$file = file_put_contents($baseDir . $img, $content->getBody());
|
442 |
if ($file) {
|
443 |
-
$this->addProductImageQuery($productId, $img, $
|
444 |
return $img;
|
445 |
} else {
|
446 |
return $img_url;
|
@@ -485,7 +489,7 @@ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
|
|
485 |
if ((isset($img_check[0]["COUNT(*)"]) && isset($gal_check[0]["COUNT(*)"]))
|
486 |
&& ($img_check[0]["COUNT(*)"] == 0 && $gal_check[0]["COUNT(*)"] == 0)
|
487 |
) {
|
488 |
-
$this->addProductImageQuery($productId, $img, $
|
489 |
}
|
490 |
return $img;
|
491 |
}
|
@@ -493,6 +497,7 @@ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
|
|
493 |
|
494 |
|
495 |
public function addProductImageQuery($productId, $img, $type = ''){
|
|
|
496 |
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
497 |
$tablePrefix = (array)Mage::getConfig()->getTablePrefix();
|
498 |
if (!empty($tablePrefix[0])) {
|
@@ -501,83 +506,149 @@ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
|
|
501 |
$tablePrefix = '';
|
502 |
}
|
503 |
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
|
530 |
-
|
531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
}
|
567 |
-
|
568 |
-
}
|
569 |
-
|
570 |
-
|
571 |
-
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery` (attribute_id,entity_id,value)
|
572 |
-
VALUES(@gallery,:entity_id,:img )", array(
|
573 |
-
':entity_id' => $productId,
|
574 |
-
':img' => $img));
|
575 |
-
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery_value`
|
576 |
-
(value_id,store_id,label,position,disabled)
|
577 |
-
VALUES(LAST_INSERT_ID(),:store_id,'',0,0 )", array(
|
578 |
-
':store_id' => $DefaultStoreId));
|
579 |
-
|
580 |
-
|
581 |
}
|
582 |
|
583 |
}
|
148 |
}
|
149 |
}
|
150 |
|
|
|
|
|
151 |
public function _saveProductCatalogImage($entityId, $productTag){
|
152 |
$Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
|
153 |
if ($Imagepriority != 'Db') {
|
161 |
}
|
162 |
}
|
163 |
|
164 |
+
/**
|
165 |
+
* Change request host for image parse https to http
|
166 |
+
* @param string $productTag
|
167 |
+
* @return string
|
168 |
+
*/
|
169 |
public function changeHostsImages($productTag){
|
170 |
+
$image_path = str_replace("http:", "https:", $productTag);
|
171 |
+
return $image_path;
|
172 |
}
|
173 |
|
174 |
public function getErrorMessage()
|
416 |
*/
|
417 |
public function saveImg($productId, $img_url, $img_type = '')
|
418 |
{
|
419 |
+
|
420 |
$pathinfo = pathinfo($img_url);
|
421 |
if(!empty($pathinfo["extension"])){
|
422 |
$img_type = $pathinfo["extension"];
|
444 |
}
|
445 |
$file = file_put_contents($baseDir . $img, $content->getBody());
|
446 |
if ($file) {
|
447 |
+
$this->addProductImageQuery($productId, $img, $img_type);
|
448 |
return $img;
|
449 |
} else {
|
450 |
return $img_url;
|
489 |
if ((isset($img_check[0]["COUNT(*)"]) && isset($gal_check[0]["COUNT(*)"]))
|
490 |
&& ($img_check[0]["COUNT(*)"] == 0 && $gal_check[0]["COUNT(*)"] == 0)
|
491 |
) {
|
492 |
+
$this->addProductImageQuery($productId, $img, $img_type);
|
493 |
}
|
494 |
return $img;
|
495 |
}
|
497 |
|
498 |
|
499 |
public function addProductImageQuery($productId, $img, $type = ''){
|
500 |
+
|
501 |
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
502 |
$tablePrefix = (array)Mage::getConfig()->getTablePrefix();
|
503 |
if (!empty($tablePrefix[0])) {
|
506 |
$tablePrefix = '';
|
507 |
}
|
508 |
|
509 |
+
try{
|
510 |
+
$attr_query = "SELECT @product_entity_type_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
|
511 |
+
entity_type_code = 'catalog_product';
|
512 |
+
SELECT @attribute_set_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
|
513 |
+
entity_type_code = 'catalog_product';
|
514 |
+
SELECT @gallery := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
|
515 |
+
`attribute_code` = 'media_gallery' AND entity_type_id = @product_entity_type_id;
|
516 |
+
SELECT @base := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE `attribute_code` = 'image' AND entity_type_id = @product_entity_type_id;
|
517 |
+
SELECT @small := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
|
518 |
+
`attribute_code` = 'small_image' AND entity_type_id = @product_entity_type_id;
|
519 |
+
SELECT @thumb := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
|
520 |
+
`attribute_code` = 'thumbnail' AND entity_type_id = @product_entity_type_id;";
|
521 |
+
|
522 |
+
$db->query($attr_query, array(':attribute_set' => Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId()));
|
523 |
+
|
524 |
+
$DefaultStoreId = 0;
|
525 |
+
|
526 |
+
|
527 |
+
$img_check = $db->fetchAll("SELECT ea.`attribute_code`, cpev.`value` FROM `" . $tablePrefix . "catalog_product_entity_varchar` AS cpev
|
528 |
+
LEFT JOIN `" . $tablePrefix . "eav_attribute` AS ea
|
529 |
+
ON ea.`attribute_id`=cpev.`attribute_id`
|
530 |
+
WHERE cpev.`entity_id`=:entity_id AND cpev.`store_id`=:store_id AND ( ea.`attribute_code`='image' OR ea.`attribute_code`='thumbnail' OR ea.`attribute_code`='small_image');",
|
531 |
+
array(
|
532 |
+
':entity_id' => $productId,
|
533 |
+
':store_id' => $DefaultStoreId,
|
534 |
+
));
|
535 |
+
|
536 |
+
if (!empty($type) || $type == 'image') {
|
537 |
+
if(!empty($img_check)){
|
538 |
+
foreach ($img_check as $image){
|
539 |
+
if(!empty($image) && $image['attribute_code'] == 'image'){
|
540 |
+
if($image['value']=='no_selection'){
|
541 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
542 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
543 |
+
VALUES(@product_entity_type_id,@base,:store_id,:entity_id,:img )
|
544 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
545 |
+
':store_id' => $DefaultStoreId,
|
546 |
+
':entity_id' => $productId,
|
547 |
+
':img' => $img));
|
548 |
+
}
|
549 |
+
}
|
550 |
|
551 |
+
if(!empty($image) && $image['attribute_code'] == 'small_image'){
|
552 |
+
if($image['value']=='no_selection'){
|
553 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
554 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
555 |
+
VALUES(@product_entity_type_id,@small,:store_id,:entity_id,:img )
|
556 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
557 |
+
':store_id' => $DefaultStoreId,
|
558 |
+
':entity_id' => $productId,
|
559 |
+
':img' => $img));
|
560 |
+
}
|
561 |
+
}
|
562 |
|
563 |
+
if(!empty($image) && $image['attribute_code'] == 'thumbnail'){
|
564 |
+
if($image['value']=='no_selection'){
|
565 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
566 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
567 |
+
VALUES(@product_entity_type_id,@thumb,:store_id,:entity_id,:img )
|
568 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
569 |
+
':store_id' => $DefaultStoreId,
|
570 |
+
':entity_id' => $productId,
|
571 |
+
':img' => $img));
|
572 |
+
}
|
573 |
+
}
|
574 |
+
}
|
575 |
+
|
576 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery` (attribute_id,entity_id,value)
|
577 |
+
VALUES(@gallery,:entity_id,:img )", array(
|
578 |
+
':entity_id' => $productId,
|
579 |
+
':img' => $img));
|
580 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery_value`
|
581 |
+
(value_id,store_id,label,position,disabled)
|
582 |
+
VALUES(LAST_INSERT_ID(),:store_id,'',0,0 )", array(
|
583 |
+
':store_id' => $DefaultStoreId));
|
584 |
+
} else {
|
585 |
|
586 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
587 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
588 |
+
VALUES(@product_entity_type_id,@base,:store_id,:entity_id,:img )
|
589 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
590 |
+
':store_id' => $DefaultStoreId,
|
591 |
+
':entity_id' => $productId,
|
592 |
+
':img' => $img));
|
593 |
+
|
594 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
595 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
596 |
+
VALUES(@product_entity_type_id,@small,:store_id,:entity_id,:img )
|
597 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
598 |
+
':store_id' => $DefaultStoreId,
|
599 |
+
':entity_id' => $productId,
|
600 |
+
':img' => $img));
|
601 |
+
|
602 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
603 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
604 |
+
VALUES(@product_entity_type_id,@thumb,:store_id,:entity_id,:img )
|
605 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
606 |
+
':store_id' => $DefaultStoreId,
|
607 |
+
':entity_id' => $productId,
|
608 |
+
':img' => $img));
|
609 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery` (attribute_id,entity_id,value)
|
610 |
+
VALUES(@gallery,:entity_id,:img )", array(
|
611 |
+
':entity_id' => $productId,
|
612 |
+
':img' => $img));
|
613 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery_value`
|
614 |
+
(value_id,store_id,label,position,disabled)
|
615 |
+
VALUES(LAST_INSERT_ID(),:store_id,'',1,0 )", array(
|
616 |
+
':store_id' => $DefaultStoreId));
|
617 |
}
|
618 |
+
} else {
|
619 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
620 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
621 |
+
VALUES(@product_entity_type_id,@base,:store_id,:entity_id,:img )
|
622 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
623 |
+
':store_id' => $DefaultStoreId,
|
624 |
+
':entity_id' => $productId,
|
625 |
+
':img' => $img));
|
626 |
+
|
627 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
628 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
629 |
+
VALUES(@product_entity_type_id,@small,:store_id,:entity_id,:img )
|
630 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
631 |
+
':store_id' => $DefaultStoreId,
|
632 |
+
':entity_id' => $productId,
|
633 |
+
':img' => $img));
|
634 |
+
|
635 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
|
636 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
637 |
+
VALUES(@product_entity_type_id,@thumb,:store_id,:entity_id,:img )
|
638 |
+
ON DUPLICATE KEY UPDATE value = :img", array(
|
639 |
+
':store_id' => $DefaultStoreId,
|
640 |
+
':entity_id' => $productId,
|
641 |
+
':img' => $img));
|
642 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery` (attribute_id,entity_id,value)
|
643 |
+
VALUES(@gallery,:entity_id,:img )", array(
|
644 |
+
':entity_id' => $productId,
|
645 |
+
':img' => $img));
|
646 |
+
$db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery_value`
|
647 |
+
(value_id,store_id,label,position,disabled)
|
648 |
+
VALUES(LAST_INSERT_ID(),:store_id,'',1,0 )", array(
|
649 |
+
':store_id' => $DefaultStoreId));
|
650 |
}
|
651 |
+
} catch (Exception $e){}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
}
|
653 |
|
654 |
}
|
app/code/local/Iceshop/Icecatlive/Model/Observer.php
CHANGED
@@ -154,6 +154,8 @@ class Iceshop_Icecatlive_Model_Observer
|
|
154 |
$DB_loger->insetrtUpdateLogValue('icecatlive_count_products_temp', $import_info['count_products']);
|
155 |
|
156 |
}else{
|
|
|
|
|
157 |
if(!$product_onlynewproducts){
|
158 |
$query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_products_titles` ON entity_id = prod_id WHERE prod_id IS NULL";
|
159 |
} else {
|
@@ -348,6 +350,7 @@ class Iceshop_Icecatlive_Model_Observer
|
|
348 |
} elseif (!$import_id) {
|
349 |
$DB_loger->insetrtUpdateLogValue('icecatlive_enddate_update_product', date('Y-m-d H:i:s'));
|
350 |
}
|
|
|
351 |
if($crone){
|
352 |
return $import_info;
|
353 |
}
|
@@ -357,6 +360,7 @@ class Iceshop_Icecatlive_Model_Observer
|
|
357 |
$DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product', $import_info['success_imported_product']);
|
358 |
$DB_loger->insetrtUpdateLogValue('icecatlive_full_icecat_product', $import_info['full_icecat_product']);
|
359 |
$import_info['done'] = 0;
|
|
|
360 |
if($crone){
|
361 |
return $import_info;
|
362 |
}
|
@@ -382,11 +386,22 @@ class Iceshop_Icecatlive_Model_Observer
|
|
382 |
}
|
383 |
}
|
384 |
|
|
|
|
|
|
|
|
|
|
|
385 |
public function _saveProductTitle($prod_id, $prod_title){
|
386 |
$connection = $this->getDbConnection();
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
$productsTitleTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/products_titles');
|
388 |
try{
|
389 |
-
$sql = " INSERT INTO
|
390 |
VALUES('" . $prod_id . "', '" . $prod_title . "')
|
391 |
ON DUPLICATE KEY UPDATE
|
392 |
prod_title = VALUES(prod_title)";
|
@@ -413,10 +428,10 @@ class Iceshop_Icecatlive_Model_Observer
|
|
413 |
$productsIdTable = Mage::getConfig()->getNode('default/icecatlive/noimportid_tables')->table_name;
|
414 |
$productsIdTable = $tablePrefix . $productsIdTable;
|
415 |
if (!$product_onlynewproducts) {
|
416 |
-
$query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `" . $tablePrefix .
|
417 |
} else {
|
418 |
$query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` AS cpe
|
419 |
-
LEFT JOIN `" . $tablePrefix .
|
420 |
ON cpe.`entity_id`= iipt.`prod_id`
|
421 |
LEFT JOIN `" . $productsIdTable . "` AS iinpi
|
422 |
ON iinpi.`prod_id` = cpe.`entity_id`
|
@@ -451,7 +466,11 @@ class Iceshop_Icecatlive_Model_Observer
|
|
451 |
return true;
|
452 |
}
|
453 |
|
454 |
-
|
|
|
|
|
|
|
|
|
455 |
public function _saveImportMessage($entity_id, $message){
|
456 |
|
457 |
$connection = $this->getDbConnection();
|
@@ -498,6 +517,13 @@ class Iceshop_Icecatlive_Model_Observer
|
|
498 |
}
|
499 |
|
500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
public function _saveXmltoIcecatLiveCache($resultString, $entity_id, $locale){
|
502 |
$current_prodCacheXml = Mage::getBaseDir('var') . $this->_connectorCacheDir . 'iceshop_icecatlive_' . $entity_id . '_' . $locale;
|
503 |
if(is_writable(Mage::getBaseDir('var') . $this->_connectorCacheDir)){
|
@@ -561,9 +587,7 @@ class Iceshop_Icecatlive_Model_Observer
|
|
561 |
{
|
562 |
$varDir = Mage::getBaseDir('var') . $this->_connectorCacheDir;
|
563 |
if (!is_dir($varDir)) {
|
564 |
-
if (is_writable(Mage::getBaseDir('var') . $this->_connectorDir)){
|
565 |
mkdir($varDir, 0777, true);
|
566 |
-
}
|
567 |
}
|
568 |
}
|
569 |
|
@@ -700,27 +724,32 @@ class Iceshop_Icecatlive_Model_Observer
|
|
700 |
}
|
701 |
$catalog_product_model = Mage::getModel('catalog/product');
|
702 |
$_product = $catalog_product_model->load($entity_id);
|
703 |
-
$
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
|
716 |
-
|
717 |
|
718 |
-
} elseif($attribute['backend_type'] == 'varchar') {
|
719 |
-
return $vendorName;
|
720 |
}
|
721 |
return '';
|
722 |
}
|
723 |
|
724 |
}
|
725 |
|
726 |
-
?>
|
154 |
$DB_loger->insetrtUpdateLogValue('icecatlive_count_products_temp', $import_info['count_products']);
|
155 |
|
156 |
}else{
|
157 |
+
|
158 |
+
|
159 |
if(!$product_onlynewproducts){
|
160 |
$query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_products_titles` ON entity_id = prod_id WHERE prod_id IS NULL";
|
161 |
} else {
|
350 |
} elseif (!$import_id) {
|
351 |
$DB_loger->insetrtUpdateLogValue('icecatlive_enddate_update_product', date('Y-m-d H:i:s'));
|
352 |
}
|
353 |
+
$DB_loger->insetrtUpdateLogValue('icecatlive_lastinsert_product_id', $entity_id);
|
354 |
if($crone){
|
355 |
return $import_info;
|
356 |
}
|
360 |
$DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product', $import_info['success_imported_product']);
|
361 |
$DB_loger->insetrtUpdateLogValue('icecatlive_full_icecat_product', $import_info['full_icecat_product']);
|
362 |
$import_info['done'] = 0;
|
363 |
+
$DB_loger->insetrtUpdateLogValue('icecatlive_lastinsert_product_id', $entity_id);
|
364 |
if($crone){
|
365 |
return $import_info;
|
366 |
}
|
386 |
}
|
387 |
}
|
388 |
|
389 |
+
/**
|
390 |
+
* Write success import product title to iceshop_icecatlive_products_titles db table
|
391 |
+
* @param integer $prod_id
|
392 |
+
* @param string $prod_title
|
393 |
+
*/
|
394 |
public function _saveProductTitle($prod_id, $prod_title){
|
395 |
$connection = $this->getDbConnection();
|
396 |
+
$db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
|
397 |
+
$tablePrefix = '';
|
398 |
+
$tPrefix = (array) Mage::getConfig()->getTablePrefix();
|
399 |
+
if (!empty($tPrefix)) {
|
400 |
+
$tablePrefix = $tPrefix[0];
|
401 |
+
}
|
402 |
$productsTitleTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/products_titles');
|
403 |
try{
|
404 |
+
$sql = " INSERT INTO `" . $tablePrefix . "iceshop_icecatlive_products_titles` ( prod_id, prod_title)
|
405 |
VALUES('" . $prod_id . "', '" . $prod_title . "')
|
406 |
ON DUPLICATE KEY UPDATE
|
407 |
prod_title = VALUES(prod_title)";
|
428 |
$productsIdTable = Mage::getConfig()->getNode('default/icecatlive/noimportid_tables')->table_name;
|
429 |
$productsIdTable = $tablePrefix . $productsIdTable;
|
430 |
if (!$product_onlynewproducts) {
|
431 |
+
$query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `" . $tablePrefix ."iceshop_icecatlive_products_titles` ON entity_id = prod_id WHERE prod_id IS NULL";
|
432 |
} else {
|
433 |
$query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` AS cpe
|
434 |
+
LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_products_titles` AS iipt
|
435 |
ON cpe.`entity_id`= iipt.`prod_id`
|
436 |
LEFT JOIN `" . $productsIdTable . "` AS iinpi
|
437 |
ON iinpi.`prod_id` = cpe.`entity_id`
|
466 |
return true;
|
467 |
}
|
468 |
|
469 |
+
/**
|
470 |
+
* Mathod add Icecat import message to icecatlive_status product status
|
471 |
+
* @param integer $entity_id
|
472 |
+
* @param string $message
|
473 |
+
*/
|
474 |
public function _saveImportMessage($entity_id, $message){
|
475 |
|
476 |
$connection = $this->getDbConnection();
|
517 |
}
|
518 |
|
519 |
|
520 |
+
/**
|
521 |
+
* Write to cache file import product information
|
522 |
+
* @param string $resultString
|
523 |
+
* @param integer $entity_id
|
524 |
+
* @param string $locale
|
525 |
+
* @return boolean
|
526 |
+
*/
|
527 |
public function _saveXmltoIcecatLiveCache($resultString, $entity_id, $locale){
|
528 |
$current_prodCacheXml = Mage::getBaseDir('var') . $this->_connectorCacheDir . 'iceshop_icecatlive_' . $entity_id . '_' . $locale;
|
529 |
if(is_writable(Mage::getBaseDir('var') . $this->_connectorCacheDir)){
|
587 |
{
|
588 |
$varDir = Mage::getBaseDir('var') . $this->_connectorCacheDir;
|
589 |
if (!is_dir($varDir)) {
|
|
|
590 |
mkdir($varDir, 0777, true);
|
|
|
591 |
}
|
592 |
}
|
593 |
|
724 |
}
|
725 |
$catalog_product_model = Mage::getModel('catalog/product');
|
726 |
$_product = $catalog_product_model->load($entity_id);
|
727 |
+
if(!empty($_product)){
|
728 |
+
$vendorName = $_product->getData($icecat_manufacturer_attribute_code);
|
729 |
+
if(!empty($vendorName)){
|
730 |
+
$query = "SELECT * FROM `{$tablePrefix}eav_attribute` AS ea WHERE ea.`attribute_code`='{$icecat_manufacturer_attribute_code}';";
|
731 |
+
$attribute = $db_res->fetchRow($query);
|
732 |
+
if($attribute['backend_type'] == 'int'){
|
733 |
+
$query = "SELECT eaov.`value` FROM `{$tablePrefix}eav_attribute_option_value` AS eaov
|
734 |
+
LEFT JOIN `{$tablePrefix}eav_attribute_option` AS eao
|
735 |
+
ON eao.`option_id` = eaov.`option_id`
|
736 |
+
LEFT JOIN `{$tablePrefix}eav_attribute` AS ea
|
737 |
+
ON ea.`attribute_id`=eao.`attribute_id`
|
738 |
+
WHERE ea.`attribute_code`='{$icecat_manufacturer_attribute_code}' AND eaov.`option_id`={$vendorName} AND eaov.`store_id`={$storeId} ;";
|
739 |
+
$attribute = $db_res->fetchRow($query);
|
740 |
+
|
741 |
+
return $attribute['value'];
|
742 |
+
|
743 |
+
} elseif($attribute['backend_type'] == 'varchar') {
|
744 |
+
return $vendorName;
|
745 |
+
}
|
746 |
|
747 |
+
}
|
748 |
|
|
|
|
|
749 |
}
|
750 |
return '';
|
751 |
}
|
752 |
|
753 |
}
|
754 |
|
755 |
+
?>
|
app/code/local/Iceshop/Icecatlive/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iceshop_Icecatlive>
|
5 |
-
<version>1.7.
|
6 |
</Iceshop_Icecatlive>
|
7 |
</modules>
|
8 |
<default>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iceshop_Icecatlive>
|
5 |
+
<version>1.7.4</version>
|
6 |
</Iceshop_Icecatlive>
|
7 |
</modules>
|
8 |
<default>
|
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/{mysql4-install-1.7.3.php → mysql4-install-1.7.4.php}
RENAMED
@@ -1,4 +1,10 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
include_once 'uninstall-old-version.php';
|
3 |
$unistaller_old_version = new Uninstall_Bintime_Icecatlive();
|
4 |
$unistaller_old_version->uninstall();
|
@@ -24,9 +30,9 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_icecatlive_noimport_product
|
|
24 |
CREATE TABLE IF NOT EXISTS {$this->getTable('icecatlive/products_titles')} (
|
25 |
`prod_id` INT(255) UNSIGNED NOT NULL,
|
26 |
`prod_title` VARCHAR(255) NULL DEFAULT NULL,
|
27 |
-
UNIQUE KEY (prod_id),
|
28 |
FOREIGN KEY (prod_id)
|
29 |
-
REFERENCES catalog_product_entity(entity_id)
|
30 |
ON DELETE CASCADE
|
31 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product titles';
|
32 |
|
@@ -37,4 +43,4 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_icecatlive_noimport_product
|
|
37 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
|
38 |
");
|
39 |
|
40 |
-
$installer->endSetup();
|
1 |
<?php
|
2 |
+
$tablePrefix = (array)Mage::getConfig()->getTablePrefix();
|
3 |
+
if (!empty($tablePrefix[0])) {
|
4 |
+
$tablePrefix = $tablePrefix[0];
|
5 |
+
} else {
|
6 |
+
$tablePrefix = '';
|
7 |
+
}
|
8 |
include_once 'uninstall-old-version.php';
|
9 |
$unistaller_old_version = new Uninstall_Bintime_Icecatlive();
|
10 |
$unistaller_old_version->uninstall();
|
30 |
CREATE TABLE IF NOT EXISTS {$this->getTable('icecatlive/products_titles')} (
|
31 |
`prod_id` INT(255) UNSIGNED NOT NULL,
|
32 |
`prod_title` VARCHAR(255) NULL DEFAULT NULL,
|
33 |
+
UNIQUE KEY (`prod_id`),
|
34 |
FOREIGN KEY (prod_id)
|
35 |
+
REFERENCES {$tablePrefix}catalog_product_entity(entity_id)
|
36 |
ON DELETE CASCADE
|
37 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product titles';
|
38 |
|
43 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
|
44 |
");
|
45 |
|
46 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/iceshop/icecatlive/ajaxstatusimport.phtml
CHANGED
@@ -6,8 +6,13 @@
|
|
6 |
display: 'none'
|
7 |
});
|
8 |
}
|
|
|
9 |
|
10 |
function import_prod_info(update, full_import, error_import, process_hash){
|
|
|
|
|
|
|
|
|
11 |
$('loading_mask_loader').setStyle({
|
12 |
width: '430px',
|
13 |
marginLeft: '-235px',
|
@@ -111,6 +116,7 @@
|
|
111 |
});
|
112 |
},
|
113 |
onFailure: function() {
|
|
|
114 |
setTimeout(function(){ import_prod_info(update,0,1); }, 500);
|
115 |
}
|
116 |
});
|
6 |
display: 'none'
|
7 |
});
|
8 |
}
|
9 |
+
var error_limit = 0;
|
10 |
|
11 |
function import_prod_info(update, full_import, error_import, process_hash){
|
12 |
+
if(error_limit > 5){
|
13 |
+
error_limit = 0;
|
14 |
+
error_import = 0;
|
15 |
+
}
|
16 |
$('loading_mask_loader').setStyle({
|
17 |
width: '430px',
|
18 |
marginLeft: '-235px',
|
116 |
});
|
117 |
},
|
118 |
onFailure: function() {
|
119 |
+
error_limit = error_limit + 1;
|
120 |
setTimeout(function(){ import_prod_info(update,0,1); }, 500);
|
121 |
}
|
122 |
});
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>IcecatLive</name>
|
4 |
-
<version>1.7.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
|
7 |
<channel>community</channel>
|
@@ -14,9 +14,9 @@
|
|
14 |
Bugfix:
|
15 |
- Minor bug fixing</notes>
|
16 |
<authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
|
17 |
-
<date>2015-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magedesign"><dir name="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>IcecatLive</name>
|
4 |
+
<version>1.7.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
|
7 |
<channel>community</channel>
|
14 |
Bugfix:
|
15 |
- Minor bug fixing</notes>
|
16 |
<authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
|
17 |
+
<date>2015-04-07</date>
|
18 |
+
<time>16:27:47</time>
|
19 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="iceshop"><dir name="icecatlive"><file name="groupattributes.xml" hash="29fb1f5d19c04221f668485dccace23d"/></dir></dir></dir><dir name="template"><dir name="iceshop"><dir name="icecatlive"><file name="groupattributes.phtml" hash="4700d3c6330273cf48625666b3e899e4"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="iceshop"><dir name="icecatlive"><file name="ajaxstatusimport.phtml" hash="b96fe113be5ada4712f86e941ac82930"/><file name="notifications.phtml" hash="90fe6df8ae9655f6f3c6c77685540c08"/></dir></dir></dir><dir name="layout"><file name="icecatlive.xml" hash="d1654d4bcbc4f11b58b728d5c269c704"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iceshop"><dir name="Icecatlive"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="3a0dfe93ead9f74b1f648d16f75c58f8"/><dir name="Product"><dir name="List"><file name="Grid.php" hash="05fd6fcae7bda3b28a1ea9947460d425"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="b9112e6539624cc88c215aecf88cef00"/><file name="UpdateButton.php" hash="78bb6e863c1c2f53720c50a0c2ec65e7"/></dir></dir></dir></dir><file name="Attributes.php" hash="394eb7d9f03b79b63fa2dd44842f262a"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="03f6259ebb44b41df7d03581bbd9c84a"/></dir></dir><file name="Related.php" hash="1bbac689a628d86ba9704a7b752df286"/><file name="Upsell.php" hash="0dfaba7ae6bc688215a56065101b4544"/></dir><dir name="CatalogSearch"><dir name="Block"><file name="Result.php" hash="199bd394ca894bf82964805270318f09"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b06f19391dba03ecaef4742a42f71902"/><file name="Db.php" hash="aab35d6232538b4e5cb1300ed83701a8"/><file name="Format.php" hash="ac13e6bb5cdc5919bfad215e1fca4a7b"/><file name="Getdata.php" hash="85dd7bf14c9b232ccf078a99241add1c"/><file name="Output.php" hash="5698b83f62043e95c5f33d603ccbc03a"/><dir name="System"><file name="System.php" hash="ea277a89745de7b28993509f8dee2bab"/><file name="Systemcheck.php" hash="53a0ad5be9259a5772c1b72ba1609b88"/></dir></dir><dir name="Model"><dir name="Catalog"><file name="Category.php" hash="e4ab9f04ded0059e3f9b7e568586d903"/><file name="Product.php" hash="03794cce61bf0e924ae33593a850d7ea"/><file name="Search.php" hash="8d5c8b59c35a8449c8e4a8e30285d38b"/></dir><file name="Import.php" hash="d93ae51aef105bbc04e557c58e63867d"/><file name="Observer.php" hash="7a4e84b3e6bcfb4c03e826a907f2dacf"/><file name="Relatedcollection.php" hash="82a0585c3404d94dcb4e3a1606bae546"/><dir name="System"><dir name="Config"><file name="Attributes.php" hash="85b2cacd4ef51fa5bb166c4394fdf6f8"/><file name="Checksystem.php" hash="782d1861c87717a347e9aeafb533cabb"/><file name="Descriptionpriority.php" hash="4facaa955e0799b94bf8c7e5e60f64d5"/><file name="Iceshoplink.php" hash="0342f048a75aa382fae42082618218f4"/><file name="Imagepriority.php" hash="ef7a85c5b4ed0562b75096e569720173"/><file name="Importdata.php" hash="25196649542ccc4df2da39f6cc1ec043"/><file name="LanguageList.xml" hash="52aaea2acd5acd2c0d4f63de4f4621bc"/><file name="Loadingtype.php" hash="35ef5c60a7fb1c81852c6e04d066f79f"/><file name="Locales.php" hash="604a6087f75a4dddbf271ac2145356a8"/><file name="Namepriority.php" hash="05e06b1e0fe303d5efc4d4f24dd1df01"/><file name="Onlynewproducts.php" hash="6e758f07cd5d5f16237b45df3492b9e7"/><file name="Productpriority.php" hash="62b5912d7af4a8c7ff5f92c887c70128"/><file name="Shortdescrpriority.php" hash="946c34829295aa50b79f1e8fa7d48eaa"/><file name="Subscription.php" hash="6c4e8895b28fdcaab6001ac2a8fa995b"/><file name="Viewattributes.php" hash="8f0ac7b0091adb1a15564f2a7b9c6b04"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ImportdataController.php" hash="c4874ee811ce4d3d446835ddc6cb2f94"/><file name="ImportproductController.php" hash="5693e28bf5ef3804ed82a9c81f820538"/><file name="ImportproductinfoController.php" hash="5f6fc5b5517b22d796e1b5a81cb199c4"/><file name="ImportprogressController.php" hash="a9212979beb0aa57447d7d70f3297a28"/></dir><file name="IcecatliveController.php" hash="05c771cbd2f3bd3f9149de56508cedd1"/><file name="ImageController.php" hash="35e08758e0dfdae450e9aaa342a6b777"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bbfbb08ba646a3f4f3fb38873858930b"/><file name="config.xml" hash="948e699aac1e4ed057ffd173a80dd69c"/><file name="system.xml" hash="106e4eca7100934fef289c95e2a6e7dc"/></dir><dir name="sql"><dir name="icecatlive_setup"><file name="mysql4-install-1.7.4.php" hash="d22be2133ec2511f52b8b2e24ee3d440"/><file name="mysql4-upgrade-0.1.0-1.6.0.php" hash="3eabfeabdd60bbea11ef1c53251de5a8"/><file name="mysql4-upgrade-0.1.1-1.6.0.php" hash="3eabfeabdd60bbea11ef1c53251de5a8"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="3eabfeabdd60bbea11ef1c53251de5a8"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="d4a9c36d50f080209df067f09b6294fb"/><file name="mysql4-upgrade-1.7.0-1.7.2" hash="d4a9c36d50f080209df067f09b6294fb"/><file name="uninstall-old-version.php" hash="ad30e3ae29ba1d7fdfe61dc05476a1d3"/></dir></dir></dir></dir></target><target name="mage"><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iceshop"><dir name="icecatlive"><dir name="images"><file name="iceshop_logo_small_16px.png" hash="4ef632b4b89a047789307b301b9dfb6e"/></dir><file name="styles.css" hash="9bfab144d8ddfd445fe3bbaecac9cc53"/></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="ICEshop"><dir name="Icecatlive"><file name="jquery-1.9.1.min.js" hash="fee4c9e0129fb2b8830a3c17638c44b0"/><file name="multi-lingual-store-field.js" hash="b99ce2b343cc5dbca86bb9165bcc444d"/><file name="script.js" hash="a66a957b7956f895a5065d8c9c5a12f8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iceshop_Icecatlive.xml" hash="b097c8e9a31651d1ab43ff1db9f30d56"/></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|