ice_import - Version 1.7.13

Version Notes

Improvements:
- Added import errors indication.
- Added grid for not imported images.
- Added method to run only images import.
- Added statistics import images.

Download this release

Release Info

Developer IceShop
Extension ice_import
Version 1.7.13
Comparing to
See all releases


Code changes from version 1.7.12 to 1.7.13

app/code/community/ICEshop/Iceimport/Block/Adminhtml/Images/List/Grid.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Block_Adminhtml_Images_List_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('iceimportGrid');
9
+ $this->setUseAjax(true);
10
+ // $this->setVarNameFilter('iceimport_filter');
11
+ // $this->setDefaultLimit($this->getCountImagesNotImport());
12
+ // $this->setPagerVisibility(false);
13
+ // $this->setFilterVisibility(false);
14
+ // $this->setSaveParametersInSession(true);
15
+ $this->_prepareCollection;
16
+ }
17
+
18
+ protected function _getStore()
19
+ {
20
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
21
+ return Mage::app()->getStore($storeId);
22
+ }
23
+
24
+ protected function _prepareCollection()
25
+ {
26
+
27
+ $store = $this->_getStore();
28
+ $collection = Mage::getModel('catalog/product')->getCollection();
29
+ $collection->addAttributeToSort('entity_id', 'DESC');
30
+
31
+ $collection->getSelect()->joinLeft( array('pt'=> 'iceshop_iceimport_image_queue'),
32
+ 'e.`entity_id` = pt.`entity_id`', array('*'))->where("pt.`is_downloaded`=2")->limit(20, 10);
33
+
34
+ if($this->checkExistingAttribute('catalog_product', 'sku')){
35
+ $collection->addAttributeToSelect('sku');
36
+ }
37
+
38
+ if ($store->getId()) {
39
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
40
+
41
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
42
+ $collection->joinAttribute(
43
+ 'mpn',
44
+ 'catalog_product/mpn',
45
+ 'entity_id',
46
+ null,
47
+ 'inner',
48
+ $adminStore
49
+ );
50
+ }
51
+ $collection->joinAttribute(
52
+ 'image_url',
53
+ 'iceshop_iceimport_image_queue/image_url',
54
+ 'entity_id',
55
+ null,
56
+ 'inner',
57
+ $store->getId()
58
+ );
59
+ }
60
+ else {
61
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
62
+ $collection->joinAttribute('mpn', 'catalog_product/mpn', 'entity_id', null, 'inner');
63
+ }
64
+ }
65
+
66
+ $this->setCollection($collection);
67
+
68
+ parent::_prepareCollection();
69
+ $this->getCollection()->addWebsiteNamesToResult();
70
+ return $this;
71
+
72
+ }
73
+
74
+ public function checkExistingAttribute($group, $attribut){
75
+ $eav = Mage::getModel('eav/config');
76
+ $attribute = $eav->getAttribute($group, $attribut);
77
+ return $attribute->getId();
78
+ }
79
+
80
+
81
+ protected function _prepareColumns()
82
+ {
83
+ if ($this->_isExport) {
84
+ $this->setDefaultLimit($this->getCountImagesNotImport());
85
+ }
86
+ $this->addColumn('entity_id',
87
+ array(
88
+ 'header'=> Mage::helper('catalog')->__('ID'),
89
+ 'width' => '50px',
90
+ 'type' => 'number',
91
+ 'index' => 'entity_id',
92
+ ));
93
+ $this->addColumn('image_url',
94
+ array(
95
+ 'header'=> Mage::helper('catalog')->__('Url'),
96
+ 'index' => 'image_url',
97
+ 'filter' => FALSE
98
+ ));
99
+
100
+ if($this->checkExistingAttribute('catalog_product', 'sku')){
101
+ $this->addColumn('sku',
102
+ array(
103
+ 'header'=> Mage::helper('catalog')->__('SKU'),
104
+ 'width' => '80px',
105
+ 'index' => 'sku',
106
+ ));
107
+ }
108
+
109
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
110
+ $this->addColumn('mpn',
111
+ array(
112
+ 'header'=> Mage::helper('catalog')->__('Manufacturer product number'),
113
+ 'width' => '80px',
114
+ 'index' => 'mpn',
115
+ ));
116
+ }
117
+ $this->addExportType('*/iceimport/exportIceimportimagesCsv', Mage::helper('iceimport')->__('CSV'));
118
+ $this->addExportType('*/iceimport/exportIceimportimagesExcel', Mage::helper('iceimport')->__('Excel XML'));
119
+
120
+ return parent::_prepareColumns();
121
+ }
122
+
123
+ public function getGridUrl()
124
+ {
125
+ return $this->getUrl('*/iceimport/grid', array('_current'=>true));
126
+ }
127
+
128
+ public function getRowUrl($row)
129
+ {
130
+ return $this->getUrl('*/catalog_product/edit', array(
131
+ 'store'=>$this->getRequest()->getParam('store'),
132
+ 'id'=>$row->getId())
133
+ );
134
+ }
135
+
136
+ public function getCountImagesNotImport(){
137
+ try{
138
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
139
+ $tablePrefix = '';
140
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
141
+ if (!empty($tPrefix)) {
142
+ $tablePrefix = $tPrefix[0];
143
+ }
144
+ return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
145
+ WHERE `is_downloaded` = 2");
146
+
147
+ } catch (Exception $e){
148
+ }
149
+ }
150
+
151
+ }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set templated
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ }
11
+
12
+ /**
13
+ * Return element html
14
+ *
15
+ * @param Varien_Data_Form_Element_Abstract $element
16
+ * @return string
17
+ */
18
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
+ {
20
+ return $this->_toHtml();
21
+ }
22
+
23
+ /**
24
+ * Return ajax url for button
25
+ *
26
+ * @return string
27
+ */
28
+ public function getAjaxCheckUrl()
29
+ {
30
+ return Mage::helper('adminhtml')->getUrl('adminhtml/iceimportimages/check/');
31
+ }
32
+
33
+ /**
34
+ * Generate button html
35
+ *
36
+ * @return string
37
+ */
38
+ public function getButtonHtml()
39
+ {
40
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'iceimport_images_button',
43
+ 'label' => $this->helper('adminhtml')->__('Import images'),
44
+ 'onclick' => 'javascript:import_prod_images(1,0); return false;'
45
+ ));
46
+ $buttons = $prod_button->toHtml();
47
+ return $buttons;
48
+ }
49
+ }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Exportall.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Exportall extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set templated
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ }
11
+
12
+ /**
13
+ * Return element html
14
+ *
15
+ * @param Varien_Data_Form_Element_Abstract $element
16
+ * @return string
17
+ */
18
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
+ {
20
+ return $this->_toHtml();
21
+ }
22
+
23
+ /**
24
+ * Return ajax url for button
25
+ *
26
+ * @return string
27
+ */
28
+ public function getAjaxCheckUrl()
29
+ {
30
+ return Mage::helper('adminhtml')->getUrl('adminhtml/iceimport/exportIceimportimagesCsvAll/');
31
+ }
32
+
33
+ /**
34
+ * Generate button html
35
+ *
36
+ * @return string
37
+ */
38
+ public function getButtonHtml()
39
+ {
40
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'iceimport_exportall_button',
43
+ 'label' => $this->helper('adminhtml')->__('Export All to CSV'),
44
+ 'onclick' => "setLocation('" . $this->getUrl('adminhtml/iceimport/exportIceimportimagesCsvAll/') . "')"
45
+ ));
46
+ $buttons = $prod_button->toHtml();
47
+ return $buttons;
48
+ }
49
+ }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Updatebutton.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Updatebutton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set templated
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ }
11
+
12
+ /**
13
+ * Return element html
14
+ *
15
+ * @param Varien_Data_Form_Element_Abstract $element
16
+ * @return string
17
+ */
18
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
+ {
20
+ return $this->_toHtml();
21
+ }
22
+
23
+ /**
24
+ * Return ajax url for button
25
+ *
26
+ * @return string
27
+ */
28
+ public function getAjaxCheckUrl()
29
+ {
30
+ return Mage::helper('adminhtml')->getUrl('adminhtml/iceimportimages/check/');
31
+ }
32
+
33
+ /**
34
+ * Generate button html
35
+ *
36
+ * @return string
37
+ */
38
+ public function getButtonHtml()
39
+ {
40
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'iceimport_images_button',
43
+ 'label' => $this->helper('adminhtml')->__('Try again'),
44
+ 'onclick' => 'javascript:import_prod_images(1,1); return false;'
45
+ ));
46
+ $buttons = $prod_button->toHtml();
47
+ return $buttons;
48
+ }
49
+ }
app/code/community/ICEshop/Iceimport/Helper/System/Systemcheck.php CHANGED
@@ -615,9 +615,60 @@ class ICEshop_Iceimport_Helper_System_Systemcheck extends Mage_Core_Helper_Abstr
615
  }
616
  }
617
 
 
 
 
 
 
 
 
 
 
 
618
  $problems_digest = new Varien_Object();
619
  $problems_digest->setData('problems', $problems);
620
  $problems_digest->setData('count', $count);
621
  return $problems_digest;
622
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  }
615
  }
616
  }
617
 
618
+ $try_delete_product = $DB_logger->getLogEntryByKey('error_try_delete_product');
619
+ $delete_product_percentage = $DB_logger->getLogEntryByKey('error_try_delete_product_percentage');
620
+ if(!empty($delete_product_percentage) && !empty($try_delete_product)) {
621
+ $problems['iceimport_delete_product'][] = array(
622
+ 'label' => 'There is a problem during last import',
623
+ 'current_value' => $try_delete_product['log_value'].$delete_product_percentage['log_value']
624
+ );
625
+ $count++;
626
+ }
627
+
628
  $problems_digest = new Varien_Object();
629
  $problems_digest->setData('problems', $problems);
630
  $problems_digest->setData('count', $count);
631
  return $problems_digest;
632
  }
633
+
634
+ public function setWarningIceimport($massage){
635
+ Mage::getSingleton('adminhtml/session')->addNotice('Warning!'.$massage);
636
+ }
637
+
638
+
639
+ public function getImagesStatistics(){
640
+ try{
641
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
642
+ $tablePrefix = '';
643
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
644
+ if (!empty($tPrefix)) {
645
+ $tablePrefix = $tPrefix[0];
646
+ }
647
+ $statistic_check = array();
648
+ $statistic_check['total_entries']['type'] = 'total_entries';
649
+ $statistic_check['total_entries']['label'] = 'Total Images Entries:';
650
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`");
651
+ $total_entries = $count_value['COUNT(*)'];
652
+ $statistic_check['total_entries']['value'] = $total_entries;
653
+
654
+ $statistic_check['total_download']['type'] = 'total_download';
655
+ $statistic_check['total_download']['label'] = 'Total Images Downloaded:';
656
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 1");
657
+ $statistic_check['total_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
658
+
659
+ $statistic_check['total_waiting_download']['type'] = 'total_waiting_download';
660
+ $statistic_check['total_waiting_download']['label'] = 'Images Waiting Download:';
661
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 0");
662
+ $statistic_check['total_waiting_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
663
+
664
+ $statistic_check['total_error_download']['type'] = 'total_error_download';
665
+ $statistic_check['total_error_download']['label'] = 'Images Download Error:';
666
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 2");
667
+ $statistic_check['total_error_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
668
+
669
+ return $statistic_check;
670
+ } catch (Exception $e){
671
+ }
672
+ }
673
+
674
  }
app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Product.php CHANGED
@@ -226,7 +226,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
226
  $tax_reprobel = $iceimportAttributes['tax_reprobel'];
227
  }
228
 
229
- // set status value
230
  $statusValue = (!empty($iceimportAttributes['status']) && $iceimportAttributes['status'] == 'Enabled') ? 1 : 2;
231
  $productData['int']['status'] = $statusValue;
232
 
@@ -412,24 +412,27 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
412
  $this->_addImageToQueue($productId, $productImage);
413
  }
414
 
415
- if ($counter < $import_total) {
416
- $session->setData("counter", (int)++$counter);
417
- }
418
 
419
- if (isset($counter) && isset($skipped_counter) && isset($import_total) && (($counter + $skipped_counter) == $import_total)) {
 
 
 
420
  $this->_runCategoriesSorting();
421
  $DB_logger = Mage::helper('iceimport/db');
422
  $this->deleteOldProducts($DB_logger);
423
 
424
- $session->unsetData('import_total');
425
- $session->unsetData('counter');
426
 
427
  $DB_logger->insertLogEntry('error' . md5(microtime(true)), 'New products skipped while export according to Iceimport settings: ' . $skipped_counter, 'stat');
428
- $session->unsetData('skipped_counter');
429
 
430
  $date = date('m/d/Y H:i:s');
431
  $DB_logger->insertLogEntry('iceimport_import_ended', $date);
432
  }
 
 
 
433
 
434
  return true;
435
  }
@@ -644,16 +647,25 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
644
  }
645
 
646
  $not_delete_category = $this->getCategoryIdEmtyUnspsc($storeId);
647
- $noDelCategory = ' AND ';
648
- foreach ($not_delete_category as $category_ID ){
649
- $noDelCategory .= '`category_id` != '.$category_ID['entity_id'] . ' ';
 
 
 
 
 
650
  }
651
 
652
  if (!empty($mapCategoryIds)) {
653
  foreach ($mapCategoryIds as $delCategoryId) {
654
  $delCategoryId = (int)$delCategoryId;
655
- $coreSaveSQL .= "DELETE FROM `{$this->_tablePrefix}catalog_category_product`
656
- WHERE `category_id` != {$delCategoryId} {$noDelCategory} AND `product_id` = @product_id;";
 
 
 
 
657
  }
658
  }
659
  try {
@@ -888,6 +900,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
888
  echo $product->getCategory() . '<br>';
889
  unset($product);
890
  } else {
 
891
  Mage::log('Unable download file to ' . $productId, $logFileName);
892
  continue;
893
  }
@@ -910,6 +923,21 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
910
  }
911
  }
912
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
913
  /**
914
  * @param $categories
915
  * @param $storeId
@@ -922,16 +950,17 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
922
  {
923
 
924
  // check if product exists
925
- $categoryId = $this->_getCategoryIdByUnspsc($unspsc);
926
 
927
  $categoryIds = array();
928
  if (!empty($categoryId)) {
 
929
  // merge categories by unspsc
930
  $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
931
  foreach ($categoryMergedArray as $category) {
932
  $categoryName = $category['name'];
933
  $categoryUnspsc = $category['unspsc'];
934
- $categoryTreeId = $this->_getCategoryIdByUnspsc($categoryUnspsc);
935
  // check category name to current store
936
  $categoryBindArray = array(
937
  ':store_id' => 0,
@@ -1008,7 +1037,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
1008
  $categoryCreateArray = array();
1009
  for ($i = count($categoryMergedArray) - 1; $i >= 0; $i--) {
1010
  $category = $categoryMergedArray[$i];
1011
- $checkCategoryId = $this->_getCategoryIdByUnspsc($category['unspsc']);
1012
  if ($checkCategoryId != null) {
1013
  $categoryId = $this->_buildCategoryTree($checkCategoryId, $storeId, $categoryCreateArray, $categoryActive);
1014
  $categoryIds[] = (int)$categoryId;
@@ -1056,10 +1085,10 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
1056
  * @param $unspsc
1057
  * @return int|null
1058
  */
1059
- protected function _getCategoryIdByUnspsc($unspsc)
1060
  {
1061
  if ($unspsc == 'default_root') {
1062
- return Mage::app()->getStore(1)->getRootCategoryId();
1063
  } else {
1064
  $categoryId = $this->_connRes->fetchRow(
1065
  "SELECT entity_id
@@ -1528,6 +1557,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
1528
  {
1529
  $delete_old_products = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products');
1530
  if ($delete_old_products) {
 
1531
  try {
1532
  $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
1533
  $db_res->query("SELECT @is_iceimport_id := `attribute_id`
@@ -1540,6 +1570,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
1540
  ON cpe.entity_id = cpev.entity_id
1541
  AND cpev.value = 1
1542
  AND cpev.attribute_id = @is_iceimport_id");
 
1543
  $count_prod = $count_prod['count_prod'];
1544
 
1545
  if ($count_prod > 0) {
@@ -1554,12 +1585,14 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
1554
  ON cpe.entity_id = iip.product_id
1555
  WHERE iip.product_id IS NULL");
1556
 
1557
- if(!empty($count_del_prod['count_del_prod'])){
1558
- $count_del_prod = $count_del_prod['count_del_prod'];
1559
  } else {
1560
  $count_del_prod = 0;
1561
  }
1562
 
 
 
1563
  if ($count_del_prod > 0) {
1564
  //iceimport products to delete exists, amount > 0
1565
  $delete_old_products_tolerance = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products_tolerance');
@@ -1581,10 +1614,13 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
1581
  $db_res->query("DELETE FROM {$this->_tablePrefix}iceshop_iceimport_imported_product_ids");
1582
  } else {
1583
  $error_message = 'Attempt to delete more old products than allowed in Iceimport configuration. Interruption of the process.';
1584
- $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message, 'error');
1585
- $error_message2 = 'Old product percentage: ' . round(($count_del_prod / $count_prod * 100), 0) . '%';
1586
- $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message2, 'error');
 
 
1587
  print $error_message;
 
1588
  exit;
1589
  }
1590
  }
@@ -1634,7 +1670,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
1634
  $query = "SELECT ccev.`entity_id` FROM `{$this->_tablePrefix}catalog_category_entity_varchar` AS ccev
1635
  LEFT JOIN `{$this->_tablePrefix}eav_attribute` AS ea
1636
  ON ea.`attribute_id` = ccev.`attribute_id`
1637
- WHERE ea.`attribute_code`='unspsc' AND ccev.`value` IS NULL AND ccev.`store_id`=:store_id;";
1638
 
1639
  return $this->_connRes->fetchAll($query, array( ':store_id' => $store_id ));
1640
  }
226
  $tax_reprobel = $iceimportAttributes['tax_reprobel'];
227
  }
228
 
229
+ // set status value
230
  $statusValue = (!empty($iceimportAttributes['status']) && $iceimportAttributes['status'] == 'Enabled') ? 1 : 2;
231
  $productData['int']['status'] = $statusValue;
232
 
412
  $this->_addImageToQueue($productId, $productImage);
413
  }
414
 
 
 
 
415
 
416
+ $counter_sum = $counter + $skipped_counter;
417
+
418
+ if (isset($counter) && isset($skipped_counter) && isset($import_total) && $counter_sum == $import_total) {
419
+
420
  $this->_runCategoriesSorting();
421
  $DB_logger = Mage::helper('iceimport/db');
422
  $this->deleteOldProducts($DB_logger);
423
 
424
+ // $session->unsetData('import_total');
425
+ // $session->unsetData('counter');
426
 
427
  $DB_logger->insertLogEntry('error' . md5(microtime(true)), 'New products skipped while export according to Iceimport settings: ' . $skipped_counter, 'stat');
428
+ // $session->unsetData('skipped_counter');
429
 
430
  $date = date('m/d/Y H:i:s');
431
  $DB_logger->insertLogEntry('iceimport_import_ended', $date);
432
  }
433
+ if ($counter < $import_total) {
434
+ $session->setData("counter", (int)++$counter);
435
+ }
436
 
437
  return true;
438
  }
647
  }
648
 
649
  $not_delete_category = $this->getCategoryIdEmtyUnspsc($storeId);
650
+ $noDelCategory = '';
651
+ if(!empty($not_delete_category)){
652
+ foreach ($not_delete_category as $category_ID ){
653
+ $noDelCategory .= ''.$category_ID['entity_id'] . ',';
654
+ }
655
+ }
656
+ if(!empty($noDelCategory)){
657
+ $noDelCategory = substr($noDelCategory, 0, -1);
658
  }
659
 
660
  if (!empty($mapCategoryIds)) {
661
  foreach ($mapCategoryIds as $delCategoryId) {
662
  $delCategoryId = (int)$delCategoryId;
663
+ $coreSaveSQL .= "DELETE FROM `{$this->_tablePrefix}catalog_category_product`";
664
+ if(!empty($noDelCategory)){
665
+ $coreSaveSQL .= "WHERE `category_id` NOT IN({$noDelCategory},{$delCategoryId}) AND `product_id` = @product_id;";
666
+ } else {
667
+ $coreSaveSQL .= "WHERE `category_id`!={$delCategoryId} AND `product_id` = @product_id;";
668
+ }
669
  }
670
  }
671
  try {
900
  echo $product->getCategory() . '<br>';
901
  unset($product);
902
  } else {
903
+ $this->setImageAsDownloadedError($queueId);
904
  Mage::log('Unable download file to ' . $productId, $logFileName);
905
  continue;
906
  }
923
  }
924
  }
925
 
926
+ /**
927
+ * @param bool $queueId
928
+ */
929
+ private function setImageAsDownloadedError($queueId = false)
930
+ {
931
+ if ($queueId) {
932
+ $this->_connRes->query(
933
+ "UPDATE `{$this->_tablePrefix}iceshop_iceimport_image_queue`
934
+ SET is_downloaded = 2
935
+ WHERE queue_id = :queue_id",
936
+ array(':queue_id' => $queueId)
937
+ );
938
+ }
939
+ }
940
+
941
  /**
942
  * @param $categories
943
  * @param $storeId
950
  {
951
 
952
  // check if product exists
953
+ $categoryId = $this->_getCategoryIdByUnspsc($unspsc,$storeId);
954
 
955
  $categoryIds = array();
956
  if (!empty($categoryId)) {
957
+
958
  // merge categories by unspsc
959
  $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
960
  foreach ($categoryMergedArray as $category) {
961
  $categoryName = $category['name'];
962
  $categoryUnspsc = $category['unspsc'];
963
+ $categoryTreeId = $this->_getCategoryIdByUnspsc($categoryUnspsc,$storeId);
964
  // check category name to current store
965
  $categoryBindArray = array(
966
  ':store_id' => 0,
1037
  $categoryCreateArray = array();
1038
  for ($i = count($categoryMergedArray) - 1; $i >= 0; $i--) {
1039
  $category = $categoryMergedArray[$i];
1040
+ $checkCategoryId = $this->_getCategoryIdByUnspsc($category['unspsc'],$storeId);
1041
  if ($checkCategoryId != null) {
1042
  $categoryId = $this->_buildCategoryTree($checkCategoryId, $storeId, $categoryCreateArray, $categoryActive);
1043
  $categoryIds[] = (int)$categoryId;
1085
  * @param $unspsc
1086
  * @return int|null
1087
  */
1088
+ protected function _getCategoryIdByUnspsc($unspsc,$storeId = 0)
1089
  {
1090
  if ($unspsc == 'default_root') {
1091
+ return Mage::app()->getStore($storeId)->getRootCategoryId();
1092
  } else {
1093
  $categoryId = $this->_connRes->fetchRow(
1094
  "SELECT entity_id
1557
  {
1558
  $delete_old_products = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products');
1559
  if ($delete_old_products) {
1560
+
1561
  try {
1562
  $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
1563
  $db_res->query("SELECT @is_iceimport_id := `attribute_id`
1570
  ON cpe.entity_id = cpev.entity_id
1571
  AND cpev.value = 1
1572
  AND cpev.attribute_id = @is_iceimport_id");
1573
+
1574
  $count_prod = $count_prod['count_prod'];
1575
 
1576
  if ($count_prod > 0) {
1585
  ON cpe.entity_id = iip.product_id
1586
  WHERE iip.product_id IS NULL");
1587
 
1588
+ if(!empty($count_del_prod['count__del_prod'])){
1589
+ $count_del_prod = $count_del_prod['count__del_prod'];
1590
  } else {
1591
  $count_del_prod = 0;
1592
  }
1593
 
1594
+ $delete_old_products_tolerance = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products_tolerance');
1595
+
1596
  if ($count_del_prod > 0) {
1597
  //iceimport products to delete exists, amount > 0
1598
  $delete_old_products_tolerance = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products_tolerance');
1614
  $db_res->query("DELETE FROM {$this->_tablePrefix}iceshop_iceimport_imported_product_ids");
1615
  } else {
1616
  $error_message = 'Attempt to delete more old products than allowed in Iceimport configuration. Interruption of the process.';
1617
+ $DB_logger->insertLogEntry('error_try_delete_product', $error_message);
1618
+ // $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message, 'error');
1619
+ $error_message2 = 'Old product percentage: ' . round(($count_del_prod / $count_prod * 100), 2) . '%';
1620
+ $DB_logger->insertLogEntry('error_try_delete_product_percentage', $error_message2);
1621
+ // $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message2, 'error');
1622
  print $error_message;
1623
+ print $error_message2;
1624
  exit;
1625
  }
1626
  }
1670
  $query = "SELECT ccev.`entity_id` FROM `{$this->_tablePrefix}catalog_category_entity_varchar` AS ccev
1671
  LEFT JOIN `{$this->_tablePrefix}eav_attribute` AS ea
1672
  ON ea.`attribute_id` = ccev.`attribute_id`
1673
+ WHERE ea.`attribute_code`='unspsc' AND (ccev.`store_id` = 0 OR ccev.`store_id`=:store_id) AND ccev.`value` IS NULL;";
1674
 
1675
  return $this->_connRes->fetchAll($query, array( ':store_id' => $store_id ));
1676
  }
app/code/community/ICEshop/Iceimport/Model/Dataflow/Convert/Parser/Csv.php CHANGED
@@ -15,8 +15,11 @@ class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_
15
 
16
  public function parse()
17
  {
 
18
  $DB_logger = Mage::helper('iceimport/db');
19
  $date = date('m/d/Y H:i:s');
 
 
20
  $DB_logger->insertLogEntry('iceimport_import_started', $date);
21
 
22
  $default_attr_set_id = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
@@ -154,8 +157,37 @@ class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_
154
  if (isset($skipped_counter)) {
155
  $session->unsetData("skipped_counter");
156
  }
 
157
 
158
  return $this;
159
  }
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
15
 
16
  public function parse()
17
  {
18
+ $this->clearIceimportIds();
19
  $DB_logger = Mage::helper('iceimport/db');
20
  $date = date('m/d/Y H:i:s');
21
+ $DB_logger->deleteLogEntry('error_try_delete_product');
22
+ $DB_logger->deleteLogEntry('error_try_delete_product_percentage');
23
  $DB_logger->insertLogEntry('iceimport_import_started', $date);
24
 
25
  $default_attr_set_id = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
157
  if (isset($skipped_counter)) {
158
  $session->unsetData("skipped_counter");
159
  }
160
+ $this->updateCatalogCategoryChildren();
161
 
162
  return $this;
163
  }
164
 
165
+
166
+ public function clearIceimportIds(){
167
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
168
+ $tablePrefix = '';
169
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
170
+ if (!empty($tPrefix)) {
171
+ $tablePrefix = $tPrefix[0];
172
+ }
173
+ $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
174
+ }
175
+
176
+
177
+ /**
178
+ * Update path to children category/root
179
+ */
180
+ public function updateCatalogCategoryChildren(){
181
+ try{
182
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
183
+ $tablePrefix = '';
184
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
185
+ if (!empty($tPrefix)) {
186
+ $tablePrefix = $tPrefix[0];
187
+ }
188
+ $db_res->query('UPDATE `'.$tablePrefix.'catalog_category_entity` SET children_count = (SELECT COUNT(*) FROM (SELECT * FROM `'.$tablePrefix.'catalog_category_entity`) AS table2 WHERE path LIKE CONCAT(`'.$tablePrefix.'catalog_category_entity`.path,"/%"));');
189
+ } catch (Exception $e){
190
+ }
191
+ }
192
+
193
  }
app/code/community/ICEshop/Iceimport/Model/Observer.php CHANGED
@@ -33,10 +33,10 @@ class ICEshop_Iceimport_Model_Observer
33
  $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Started');
34
  $DB_logger->insertLogEntry('iceimport_import_started', $date);
35
  $DB_logger->insertLogEntry('iceimport_import_ended', '');
 
 
36
  $this->setCroneStatus('running',$date_crone_start);
37
 
38
-
39
-
40
  //init DB data
41
  $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
42
  $tablePrefix = '';
@@ -209,5 +209,231 @@ class ICEshop_Iceimport_Model_Observer
209
  }
210
  }
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  }
213
 
33
  $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Started');
34
  $DB_logger->insertLogEntry('iceimport_import_started', $date);
35
  $DB_logger->insertLogEntry('iceimport_import_ended', '');
36
+ $DB_logger->deleteLogEntry('error_try_delete_product');
37
+ $DB_logger->deleteLogEntry('error_try_delete_product_percentage');
38
  $this->setCroneStatus('running',$date_crone_start);
39
 
 
 
40
  //init DB data
41
  $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
42
  $tablePrefix = '';
209
  }
210
  }
211
 
212
+
213
+ /**
214
+ * Method import imges for product
215
+ */
216
+ public function importImages(){
217
+
218
+ $DB_logger = Mage::helper('iceimport/db');
219
+ $import_info = array();
220
+ if($_GET['import_run']==1){
221
+ $iceimport_count_images = $this->getCountImagesNotImport($_GET['update_images']);
222
+ $DB_logger->insertLogEntry('iceimport_count_images', $iceimport_count_images);
223
+ } else {
224
+ $iceimport_count_images = $DB_logger->getLogEntryByKey('iceimport_count_images');
225
+ if(!empty($iceimport_count_images)){
226
+ $iceimport_count_images = $iceimport_count_images ['log_value'];
227
+ }
228
+ }
229
+
230
+ $iceimport_current_images_import = $DB_logger->getLogEntryByKey('iceimport_current_images_import');
231
+ if(!empty($iceimport_current_images_import)){
232
+ $iceimport_current_images_import = $iceimport_current_images_import['log_value'];
233
+ }
234
+
235
+ if(empty($iceimport_count_images)){
236
+ $iceimport_count_images = $this->getCountImagesNotImport($_GET['update_images']);
237
+ $DB_logger->insertLogEntry('iceimport_count_images', $iceimport_count_images);
238
+ }
239
+ $import_info['count_images'] = $iceimport_count_images;
240
+
241
+
242
+ if(empty($iceimport_current_images_import)){
243
+ $iceimport_current_images_import = 1;
244
+ $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
245
+ } else {
246
+ $iceimport_current_images_import = $iceimport_current_images_import + 1;
247
+ $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
248
+ }
249
+ if($_GET['import_run']==1){
250
+ $iceimport_current_images_import = 1;
251
+ $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
252
+ }
253
+ $import_info['current_images_import'] = $iceimport_current_images_import;
254
+
255
+ // download & set product images
256
+ $queueList = $this->getImageResourceOne($_GET['update_images']);
257
+ if (count($queueList) > 0) {
258
+ $mediaDir = Mage::getBaseDir('media');
259
+ foreach ($queueList as $queue) {
260
+ $queueId = $queue['queue_id'];
261
+ $productId = $queue['entity_id'];
262
+ $imageUrl = $queue['image_url'];
263
+
264
+ $preImageName = explode('/', $imageUrl);
265
+ $imageName = array_pop($preImageName);
266
+ if (file_exists($mediaDir . DS . $imageName)) {
267
+ $imageName = rand() . '_' . time() . $imageName;
268
+ }
269
+
270
+ if (file_put_contents($mediaDir . DS . $imageName, file_get_contents($imageUrl))) {
271
+ $product = Mage::getModel('catalog/product')->load($productId);
272
+ $product->addImageToMediaGallery($mediaDir . DS . $imageName,
273
+ array('image', 'small_image', 'thumbnail'),
274
+ true, true
275
+ );
276
+ $product->save();
277
+ $this->setImageAsDownloaded($queueId);
278
+ unset($product);
279
+ $import_info['images_error'] = 0;
280
+ } else {
281
+ $this->setImageAsDownloadedError($queueId);
282
+
283
+ $iceimport_images_error_entity_id = $DB_logger->getLogEntryByKey('iceimport_images_error_entity_id');
284
+ if(empty($iceimport_images_error_entity_id)){
285
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id', $productId);
286
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id_log', $productId);
287
+ } else {
288
+ if(!empty($iceimport_images_error_entity_id)){
289
+ $iceimport_images_error_entity_id = $iceimport_images_error_entity_id['log_value'];
290
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id_log', $iceimport_images_error_entity_id . ', ' . $productId);
291
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id', $iceimport_images_error_entity_id . ', ' . $productId);
292
+
293
+ }
294
+ }
295
+ $import_info['images_error'] = 1;
296
+ $import_info['images_error_text'] = 'Requested file is not accessible. '.$imageUrl;
297
+ }
298
+ }
299
+ $import_info['done'] = 0;
300
+ } else {
301
+ $import_info['done'] = 1;
302
+ if($import_info['count_images'] == 0){
303
+ $import_info['current_images_import'] = 0;
304
+ }
305
+ $DB_logger->deleteLogEntry('iceimport_current_images_import');
306
+ $DB_logger->deleteLogEntry('iceimport_count_images');
307
+ }
308
+
309
+ if($import_info['current_images_import'] == $import_info['count_images'] || $import_info['done'] == 1){
310
+ $import_info['done'] = 1;
311
+ $DB_logger->deleteLogEntry('iceimport_images_error_entity_id');
312
+ $DB_logger->deleteLogEntry('iceimport_current_images_import');
313
+ $DB_logger->deleteLogEntry('iceimport_count_images');
314
+ }elseif ($import_info['count_images'] == 0 || $import_info['current_images_import'] == 0) {
315
+ $import_info['count_images'] = 0;
316
+ $import_info['current_images_import'] = 0;
317
+
318
+ $import_info['done'] = 1;
319
+ $DB_logger->deleteLogEntry('iceimport_current_images_import');
320
+ $DB_logger->deleteLogEntry('iceimport_count_images');
321
+ echo json_encode($import_info);
322
+ exit();
323
+ } else {
324
+ $import_info['done'] = 0;
325
+ }
326
+ echo json_encode($import_info);
327
+
328
+ }
329
+
330
+ /**
331
+ * @return mixed
332
+ */
333
+ public function getImageResourceOne($update = 0)
334
+ {
335
+ try{
336
+ $DB_logger = Mage::helper('iceimport/db');
337
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
338
+ $tablePrefix = '';
339
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
340
+ if (!empty($tPrefix)) {
341
+ $tablePrefix = $tPrefix[0];
342
+ }
343
+
344
+ $iceimport_images_error_entity_id = $DB_logger->getLogEntryByKey('iceimport_images_error_entity_id');
345
+ if(empty($iceimport_images_error_entity_id)){
346
+ if($update){
347
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
348
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
349
+ WHERE `is_downloaded` = 2 LIMIT 1");
350
+ }else{
351
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
352
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
353
+ WHERE `is_downloaded` = 0 LIMIT 1");
354
+ }
355
+
356
+ } else {
357
+ $iceimport_images_error_entity_id = $iceimport_images_error_entity_id['log_value'];
358
+ if($update){
359
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
360
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
361
+ WHERE `is_downloaded` = 2 AND entity_id NOT IN({$iceimport_images_error_entity_id}) LIMIT 1");
362
+ } else {
363
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
364
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
365
+ WHERE `is_downloaded` = 0 AND entity_id NOT IN({$iceimport_images_error_entity_id}) LIMIT 1");
366
+ }
367
+
368
+ }
369
+
370
+ } catch (Exception $e){
371
+ }
372
+ }
373
+
374
+ /**
375
+ * Method fetch count not import images for product
376
+ * @return integer
377
+ */
378
+ public function getCountImagesNotImport($update = 0){
379
+ try{
380
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
381
+ $tablePrefix = '';
382
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
383
+ if (!empty($tPrefix)) {
384
+ $tablePrefix = $tPrefix[0];
385
+ }
386
+ if($update){
387
+ return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
388
+ WHERE `is_downloaded` = 2");
389
+ } else {
390
+ return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
391
+ WHERE `is_downloaded` = 0");
392
+ }
393
+ } catch (Exception $e){
394
+ }
395
+ }
396
+
397
+
398
+
399
+ /**
400
+ * @param bool $queueId
401
+ */
402
+ private function setImageAsDownloaded($queueId = false)
403
+ {
404
+ if ($queueId) {
405
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
406
+ $tablePrefix = '';
407
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
408
+ if (!empty($tPrefix)) {
409
+ $tablePrefix = $tPrefix[0];
410
+ }
411
+ $db_res->query("UPDATE `{$tablePrefix}iceshop_iceimport_image_queue`
412
+ SET is_downloaded = 1
413
+ WHERE queue_id = {$queueId}");
414
+ }
415
+ }
416
+
417
+
418
+ /**
419
+ * @param bool $queueId
420
+ */
421
+ private function setImageAsDownloadedError($queueId = false)
422
+ {
423
+ if ($queueId) {
424
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
425
+ $tablePrefix = '';
426
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
427
+ if (!empty($tPrefix)) {
428
+ $tablePrefix = $tPrefix[0];
429
+ }
430
+ $db_res->query(
431
+ "UPDATE `{$tablePrefix}iceshop_iceimport_image_queue`
432
+ SET is_downloaded = 2
433
+ WHERE queue_id = :queue_id",
434
+ array(':queue_id' => $queueId)
435
+ );
436
+ }
437
+ }
438
  }
439
 
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimagesController.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Adminhtml_IceimagesController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function getGridTable()
7
+ {
8
+ return $this->getResponse()->setBody(
9
+ $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid')->toHtml()
10
+ );
11
+ }
12
+ }
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimportController.php CHANGED
@@ -1,7 +1,14 @@
1
  <?php
2
-
3
  class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Controller_Action
4
  {
 
 
 
 
 
 
 
5
 
6
  /**
7
  * indexAction
@@ -35,20 +42,34 @@ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Con
35
  <?php
36
  $i = 1;
37
  foreach ($problems as $problem_section_name => $problem_section) {
38
- foreach ($problem_section as $problem_name => $problem_value) {
39
- print '<tr>';
40
- print '<td class="label">';
41
- print '<label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
42
- print '</td>';
43
- print '<td class="value">';
44
- if ($problem_section_name != 'iceimport_log') {
45
- print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> ' . $helper->__('current value is') . ' <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span> ' . $helper->__('and recommended value is') . ' <span class="requirement-passed">"' . (!empty($problem_value['recommended_value']) ? $problem_value['recommended_value'] : '') . '"</span>. ' . $helper->__(' Check this parameter in') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
46
- } else {
47
- print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span>. ' . $helper->__(' Check ') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
- print '</td>';
50
- print '</tr>';
51
- $i++;
52
  }
53
  }
54
  ?>
@@ -73,6 +94,10 @@ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Con
73
  $data_flows = $DB_checker->getRowCountByField($DB_checker->getTableName('dataflow_batch_import'), 'batch_id', false, ' ORDER BY 1 DESC LIMIT 50');
74
  $currently_imported_products = $DB_checker->getRowsCount($DB_checker->_prefix . "iceshop_iceimport_imported_product_ids");
75
  $table_name = $DB_checker->getTableName('dataflow_profile_history');
 
 
 
 
76
  $last_started_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_started');
77
  $last_finished_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_ended');
78
  $import_status_cron = $DB_checker->getLogEntryByKey('iceimport_import_status_cron');
@@ -140,6 +165,7 @@ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Con
140
  <?php if (!empty($last_imported_products_count['log_value'])) echo $last_imported_products_count['log_value']; else echo "0"; ?>
141
  </td>
142
  </tr>
 
143
  <tr>
144
  <td class="label">
145
  <label><?php print $helper->__("Removed out of date products last time "); ?>:</label>
@@ -148,6 +174,17 @@ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Con
148
  <?php if (!empty($last_deleted_products_count['log_value'])) echo $last_deleted_products_count['log_value']; else echo "0"; ?>
149
  </td>
150
  </tr>
 
 
 
 
 
 
 
 
 
 
 
151
  </table>
152
  </div>
153
  </div>
@@ -584,6 +621,63 @@ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Con
584
  </div>
585
  </div>
586
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
587
  <style>
588
  .requirement-passed {
589
  color: green;
@@ -593,6 +687,97 @@ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Con
593
  color: red;
594
  }
595
  </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  <?php
597
  $system_check_content = ob_get_contents();
598
  ob_end_clean();
@@ -885,4 +1070,48 @@ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Con
885
  print str_pad('', 100, '=') . "\n";
886
  //========================================
887
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  }
1
  <?php
2
+ require_once 'IceimagesController.php';
3
  class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Controller_Action
4
  {
5
+ public $_gridTables = NULL;
6
+
7
+ public function _construct() {
8
+ $this->_gridTables = new Iceshop_Icecatlive_Adminhtml_IceimagesController($this->getRequest(), $this->getResponse());
9
+ parent::_construct();
10
+ }
11
+
12
 
13
  /**
14
  * indexAction
42
  <?php
43
  $i = 1;
44
  foreach ($problems as $problem_section_name => $problem_section) {
45
+ if($problem_section_name !='iceimport_delete_product'){
46
+ foreach ($problem_section as $problem_name => $problem_value) {
47
+ print '<tr>';
48
+ print '<td class="label">';
49
+ print '<label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
50
+ print '</td>';
51
+ print '<td class="value">';
52
+ if ($problem_section_name != 'iceimport_log') {
53
+ print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> ' . $helper->__('current value is') . ' <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span> ' . $helper->__('and recommended value is') . ' <span class="requirement-passed">"' . (!empty($problem_value['recommended_value']) ? $problem_value['recommended_value'] : '') . '"</span>. ' . $helper->__(' Check this parameter in') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
54
+ } else {
55
+ print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span>. ' . $helper->__(' Check ') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
56
+ }
57
+ print '</td>';
58
+ print '</tr>';
59
+ $i++;
60
+ }
61
+ } else {
62
+ foreach ($problem_section as $problem_name => $problem_value) {
63
+ print '<tr>';
64
+ print '<td class="label">';
65
+ print '<label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
66
+ print '</td>';
67
+ print '<td class="value">';
68
+ print '<span class="requirement-failed">' . $problem_value['label'] . ': </span> <span class="requirement">' . $problem_value['current_value'] . '</span> ';
69
+ print '</td>';
70
+ print '</tr>';
71
+ $i++;
72
  }
 
 
 
73
  }
74
  }
75
  ?>
94
  $data_flows = $DB_checker->getRowCountByField($DB_checker->getTableName('dataflow_batch_import'), 'batch_id', false, ' ORDER BY 1 DESC LIMIT 50');
95
  $currently_imported_products = $DB_checker->getRowsCount($DB_checker->_prefix . "iceshop_iceimport_imported_product_ids");
96
  $table_name = $DB_checker->getTableName('dataflow_profile_history');
97
+
98
+ $try_delete_product = $DB_checker->getLogEntryByKey('error_try_delete_product');
99
+ $delete_product_percentage = $DB_checker->getLogEntryByKey('error_try_delete_product_percentage');
100
+
101
  $last_started_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_started');
102
  $last_finished_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_ended');
103
  $import_status_cron = $DB_checker->getLogEntryByKey('iceimport_import_status_cron');
165
  <?php if (!empty($last_imported_products_count['log_value'])) echo $last_imported_products_count['log_value']; else echo "0"; ?>
166
  </td>
167
  </tr>
168
+
169
  <tr>
170
  <td class="label">
171
  <label><?php print $helper->__("Removed out of date products last time "); ?>:</label>
174
  <?php if (!empty($last_deleted_products_count['log_value'])) echo $last_deleted_products_count['log_value']; else echo "0"; ?>
175
  </td>
176
  </tr>
177
+ <?php if(!empty($delete_product_percentage) && !empty($try_delete_product)) { ?>
178
+ <tr>
179
+ <td class="label">
180
+ <label><?php print $helper->__("Attempt to remove a large amount of products "); ?>:</label>
181
+ </td>
182
+ <td class="value">
183
+ <?php echo $try_delete_product['log_value'].$delete_product_percentage['log_value']; ?>
184
+ </td>
185
+ </tr>
186
+ <?php } ?>
187
+
188
  </table>
189
  </div>
190
  </div>
621
  </div>
622
  </div>
623
  </div>
624
+ <?php //Image Statistics ?>
625
+ <span id="iceimport_image-statistics-section"></span>
626
+ <div class="entry-edit">
627
+ <div class="entry-edit-head collapseable">
628
+ <a href="#" class="section-toggler-iceimport">Images Statistics</a>
629
+ </div>
630
+
631
+ <div class="fieldset iceimport-hidden">
632
+ <div class="hor-scroll">
633
+ <table class="form-list" cellspacing="0" cellpadding="0">
634
+ <?php
635
+ $image_statistics = $checker->getImagesStatistics();
636
+ print '<tbody>';
637
+ if(!empty($image_statistics)){
638
+ foreach ($image_statistics as $statistic){
639
+ if($statistic['type'] == 'total_error_download' && $statistic['value'] > 0){
640
+ $update_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_updatebutton');
641
+ print '<tr>';
642
+ print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
643
+ print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
644
+ print "<td class=\"label\">{$update_button->getButtonHtml()}</td>";
645
+ print '</tr>';
646
+ } else if($statistic['type'] == 'total_waiting_download' && $statistic['value'] > 0){
647
+ $button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_button');
648
+ print '<tr>';
649
+ print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
650
+ print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
651
+ print "<td class=\"label\">{$button->getButtonHtml()}</td>";
652
+ print '</tr>';
653
+ } else {
654
+ if(!empty($statistic['label']) || !empty($statistic['value'])){
655
+ print '<tr>';
656
+ print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
657
+ print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
658
+ print "<td></td>";
659
+ print '</tr>';
660
+ }
661
+ }
662
+ }
663
+ }
664
+ print '</tbody>';
665
+ ?>
666
+ </table>
667
+ <div id="gridActionClener" class="hor-scroll">
668
+ <?php
669
+ if(!empty($image_statistics)){
670
+ if(!empty( $image_statistics['total_error_download']['value'])&&$image_statistics['total_error_download']['value']>0){
671
+ $exportall_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_exportall');
672
+ echo $this->_gridTables->getGridTable().$exportall_button->getButtonHtml();
673
+
674
+ }
675
+ }
676
+ ?>
677
+ </div>
678
+ </div>
679
+ </div>
680
+ </div>
681
  <style>
682
  .requirement-passed {
683
  color: green;
687
  color: red;
688
  }
689
  </style>
690
+ <script type="text/javascript">
691
+
692
+
693
+ function import_prod_images(import_run, update){
694
+ $('loading_mask_loader').setStyle({
695
+ width: '430px',
696
+ marginLeft: '-235px',
697
+ top: '25%'
698
+ });
699
+ $('loading-mask').setStyle({
700
+ display: 'inline',
701
+ opacity: '0.90'
702
+ });
703
+ $$('#loading_mask_loader > img')[0].setStyle({
704
+ 'display': 'inline'
705
+ });
706
+ var str = $('loading_mask_loader').innerHTML;
707
+ str = str.replace('<br>Please wait...', '');
708
+ $('loading_mask_loader').innerHTML = str;
709
+
710
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/iceimportimages/check/"); ?>', {
711
+ method: 'get',
712
+ parameters: {import_run: import_run, update_images:update},
713
+ onSuccess: function(data){
714
+ var import_info = JSON.parse(data.responseText);
715
+ var images_error_text = '';
716
+ var images_error = import_info.images_error;
717
+ if(images_error){
718
+ images_error_text = '<p> Import images error: ' + import_info.images_error_text + '</p>';
719
+ }
720
+ var iceimport_count_images = '<p> Found images not imported: '+import_info.count_images+'</p>';
721
+ var iceimport_current_images_import = '<p> Current images import: '+import_info.current_images_import+'</p>';
722
+ if(import_info.done != 1){
723
+ if($('loading_mask_loader').select('#iceimport-images-response').size() == 0){
724
+ $('loading_mask_loader').insert({bottom: '<div id="iceimport-images-response" style="text-align: left">'
725
+ +iceimport_count_images
726
+ +iceimport_current_images_import
727
+ +images_error_text
728
+ +'</div>'});
729
+ }else{
730
+ $('iceimport-images-response').replace('<div id="iceimport-images-response" style="text-align: left">'
731
+ +iceimport_count_images
732
+ +iceimport_current_images_import
733
+ +images_error_text
734
+ +'</div>');
735
+ }
736
+ import_prod_images(0,update);
737
+ }else{
738
+ if($('loading_mask_loader').select('#iceimport-images-response').size() == 0){
739
+ $('loading_mask_loader').insert({bottom: '<div id="iceimport-images-response" style="text-align: left">'
740
+ +iceimport_count_images
741
+ +iceimport_current_images_import
742
+ +images_error_text
743
+ +'</div>'
744
+ +'<button id="iceimport_images_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>'});
745
+ }else{
746
+ $('iceimport-images-response').replace('<div id="iceimport-images-response" style="text-align: left">'
747
+ +iceimport_count_images
748
+ +iceimport_current_images_import
749
+ +images_error_text
750
+ +'</div>'
751
+ +'<button id="iceimport_images_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>');
752
+ }
753
+ $$('#loading_mask_loader > img')[0].setStyle({
754
+ 'display': 'none'
755
+ });
756
+ var str = $('loading_mask_loader').innerHTML;
757
+ str = str.replace('<br>Please wait...', '');
758
+ $('loading_mask_loader').innerHTML = str;
759
+ }
760
+ },
761
+ onComplete: function(){
762
+ $('loading_mask').setStyle({
763
+ display: 'none'
764
+ });
765
+ },
766
+ onFailure: function() {
767
+ import_prod_images(1,update);
768
+ }
769
+ });
770
+ }
771
+
772
+ function hide_progress_popup(){
773
+ document.getElementById("iceimport_images_button_finish").remove();
774
+ document.getElementById('iceimport-images-response').innerHTML = '';
775
+ $('loading-mask').setStyle({
776
+ display: 'none'
777
+ });
778
+ }
779
+
780
+ </script>
781
  <?php
782
  $system_check_content = ob_get_contents();
783
  ob_end_clean();
1070
  print str_pad('', 100, '=') . "\n";
1071
  //========================================
1072
  }
1073
+
1074
+
1075
+ /**
1076
+ * Method for export to csv file
1077
+ */
1078
+ public function exportIceimportimagesCsvAction()
1079
+ {
1080
+ $fileName = 'notimport_images.csv';
1081
+ $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1082
+ $grid->setDefaultLimit($grid->getCountImagesNotImport());
1083
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
1084
+ }
1085
+
1086
+ /**
1087
+ * Method for export to excel file
1088
+ */
1089
+ public function exportIceimportimagesExcelAction() {
1090
+ $fileName = 'notimport_images.xml';
1091
+ $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1092
+ $grid->setDefaultLimit($grid->getCountImagesNotImport());
1093
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
1094
+ }
1095
+
1096
+ /**
1097
+ * Images grid for AJAX request
1098
+ */
1099
+ public function gridAction() {
1100
+ $exportall_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_exportall');
1101
+ $this->_gridTables->getGridTable().$exportall_button->getButtonHtml();
1102
+ }
1103
+
1104
+ /**
1105
+ * Method for export to csv file
1106
+ */
1107
+ public function exportIceimportimagesCsvAllAction()
1108
+ {
1109
+ $fileName = 'notimport_images.csv';
1110
+ $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1111
+ $grid->setDefaultLimit($grid->getCountImagesNotImport());
1112
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
1113
+ }
1114
+
1115
+
1116
+
1117
  }
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimportimagesController.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ICEshop_Iceimport_Adminhtml_IceimportimagesController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+
6
+ /**
7
+ * Return some checking result
8
+ *
9
+ * @return void
10
+ */
11
+ public function checkAction()
12
+ {
13
+
14
+ $result = Mage::getModel('iceimport/observer')->importImages();
15
+ Mage::app()->getResponse()->setBody($result);
16
+ }
17
+
18
+ }
app/code/community/ICEshop/Iceimport/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <ICEshop_Iceimport>
5
- <version>1.7.12</version>
6
  </ICEshop_Iceimport>
7
  </modules>
8
  <admin>
@@ -117,7 +117,6 @@
117
  <delete_old_products>1</delete_old_products>
118
  <import_product_ean>1</import_product_ean>
119
  <import_product_mpn>1</import_product_mpn>
120
- <!--<import_product_brand>1</import_product_brand>-->
121
  <import_product_brand_name>1</import_product_brand_name>
122
  <import_product_name>1</import_product_name>
123
  <import_product_short_description>1</import_product_short_description>
@@ -126,7 +125,6 @@
126
  <import_product_summary_description>1</import_product_summary_description>
127
  <import_prices>1</import_prices>
128
  <import_stock>1</import_stock>
129
- <!--<import_delivery_eta>1</import_delivery_eta>-->
130
  <import_product_delivery_eta>1</import_product_delivery_eta>
131
  <import_images>1</import_images>
132
  <update_categories_from_csv>1</update_categories_from_csv>
2
  <config>
3
  <modules>
4
  <ICEshop_Iceimport>
5
+ <version>1.7.13</version>
6
  </ICEshop_Iceimport>
7
  </modules>
8
  <admin>
117
  <delete_old_products>1</delete_old_products>
118
  <import_product_ean>1</import_product_ean>
119
  <import_product_mpn>1</import_product_mpn>
 
120
  <import_product_brand_name>1</import_product_brand_name>
121
  <import_product_name>1</import_product_name>
122
  <import_product_short_description>1</import_product_short_description>
125
  <import_product_summary_description>1</import_product_summary_description>
126
  <import_prices>1</import_prices>
127
  <import_stock>1</import_stock>
 
128
  <import_product_delivery_eta>1</import_product_delivery_eta>
129
  <import_images>1</import_images>
130
  <update_categories_from_csv>1</update_categories_from_csv>
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/{mysql4-install-1.7.9.php → mysql4-install-1.7.13} RENAMED
File without changes
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.9-1.7.13 ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ include_once 'uninstall-old-version.php';
3
+ $unistaller_old_version = new Uninstall_Capacitywebsolutions_Importproduct();
4
+ $unistaller_old_version->uninstall();
5
+ $installer = $this;
6
+ $installer->startSetup();
7
+
8
+ $entityTypeId = $installer->getEntityTypeId('catalog_category');
9
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
10
+ $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
11
+
12
+ $installer->addAttribute('catalog_category', 'unspsc', array(
13
+ 'type' => 'varchar',
14
+ 'label' => 'unspsc',
15
+ 'input' => 'text',
16
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
17
+ 'visible' => true,
18
+ 'required' => false,
19
+ 'user_defined' => false,
20
+ 'default' => 0
21
+ ));
22
+
23
+ $installer->addAttributeToGroup(
24
+ $entityTypeId,
25
+ $attributeSetId,
26
+ $attributeGroupId,
27
+ 'unspsc',
28
+ '11'
29
+ );
30
+
31
+ $attributeId = $installer->getAttributeId($entityTypeId, 'unspsc');
32
+
33
+ $installer->run("
34
+
35
+ DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
36
+ DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
37
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`;
38
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}`;
39
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_extensions_logs')}`;
40
+
41
+
42
+ INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
43
+ (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
44
+ SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
45
+ FROM `{$installer->getTable('catalog_category_entity')}`;
46
+
47
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}` (
48
+ `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
49
+ `entity_id` INT(10) UNSIGNED NOT NULL,
50
+ `image_url` VARCHAR(255) NOT NULL,
51
+ `is_downloaded` TINYINT NOT NULL DEFAULT 0,
52
+ PRIMARY KEY(`queue_id`),
53
+ UNIQUE KEY (`entity_id`, `image_url`),
54
+ CONSTRAINT `FK_CAP_PRD_IMG_QUEUE_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE
55
+ )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
56
+
57
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
58
+ `product_id` int(11) NOT NULL,
59
+ `product_sku` varchar(255) DEFAULT NULL,
60
+ KEY `pi_idx` (`product_id`)
61
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
62
+
63
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
64
+ `log_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
65
+ `log_key` VARCHAR(255) NOT NULL,
66
+ `log_value` TEXT,
67
+ `log_type` VARCHAR(10) NOT NULL DEFAULT 'info',
68
+ `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
69
+ UNIQUE KEY (`log_key`),
70
+ KEY `IDX_LOG_TYPE` (`log_type`),
71
+ KEY `IDX_TIMECOL` (`timecol`)
72
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
73
+ ");
74
+
75
+ $installer->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ice_import</name>
4
- <version>1.7.12</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
7
  <channel>community</channel>
@@ -9,12 +9,14 @@
9
  <summary>Import categories &amp; productsr</summary>
10
  <description>This extension can use to import products with categories, multiple images and custom options from CSV file.</description>
11
  <notes>Improvements:&#xD;
12
- - Update categories path.&#xD;
13
- - Check the existence of an attribute in the store.</notes>
 
 
14
  <authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
15
- <date>2015-04-20</date>
16
- <time>08:17:22</time>
17
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ICEshop_Iceimport.xml" hash="566089f8d3a54436ae62ebd4c5124293"/></dir><dir name="template"><dir name="iceshop"><dir name="iceimport"><file name="notifications.phtml" hash="3d9336ffcd90d11a34271d01b0b7fa9e"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="ICEshop"><dir name="Iceimport"><file name="jquery-1.11.1.min.js" hash="056fd2a776eae867b7e2b5ddcb754d78"/><file name="script.js" hash="dabaaf1b4924cb8a2fd4e14de93f74e6"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iceshop"><dir name="iceimport"><dir name="images"><file name="iceshop_logo_small_16px.png" hash="4ef632b4b89a047789307b301b9dfb6e"/></dir><file name="styles.css" hash="0136e37ac22d82753fafec8294bc8555"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="4355538a30333b5c61cfe1550ae0129b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="fd9775a248481ddd683926452affb9ff"/><file name="Db.php" hash="564941a7ee03c28f46d282681c0c7c10"/><file name="Format.php" hash="5c56ce9db24076c52b198325fb637758"/><dir name="System"><file name="System.php" hash="ff58fc97338b95e165de85ef640147de"/><file name="Systemcheck.php" hash="642ef9dca28a880ac9d6b94e7f0d414a"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Product.php" hash="7ebd48ee538aab47d49f48e84ac49723"/></dir></dir><dir name="Dataflow"><dir name="Batch"><file name="Import.php" hash="52c0ed7367b2200a17a48103e953ae58"/></dir><dir name="Convert"><dir name="Parser"><file name="Csv.php" hash="d8376f5c1091b3d6185059c845af3272"/></dir></dir></dir><file name="Observer.php" hash="9004ab8d30aa721cb985cafde9bc84a9"/><dir name="System"><dir name="Config"><file name="Checksystem.php" hash="260200dc8cecfa718b32fa47468282df"/><file name="Defaulttax.php" hash="898bf21060622bf8dc96469eb018c463"/><file name="Iceshoplink.php" hash="e77e62b0c00e2569ea5fdb0fb91ff90a"/><file name="Yesno.php" hash="59e349561a36e02f44b47301fce99ef5"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IceimportController.php" hash="10440af0556f950fbdf9f32c7f8bc2ef"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2990ebf927b0476b7702731ad2979682"/><file name="config.xml" hash="912949d21b87ef038a0307aae8e12f92"/><file name="system.xml" hash="7d9ca6cae327ed02bebebaa54c686439"/></dir><dir name="sql"><dir name="iceimport_setup"><file name="mysql4-install-1.7.9.php" hash="e5b8e89aea9a674f0cd25718d5d62a1c"/><file name="mysql4-upgrade-0.1.0-1.7.0.php" hash="ff0682cde32b4f694bf1bed2c55a97f6"/><file name="mysql4-upgrade-1.4.0-1.7.0.php" hash="ff0682cde32b4f694bf1bed2c55a97f6"/><file name="mysql4-upgrade-1.5.0-1.7.0.php" hash="b51e20fdab764b90c6fd81551d9e368f"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="b51e20fdab764b90c6fd81551d9e368f"/><file name="mysql4-upgrade-1.6.0-1.7.5.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="mysql4-upgrade-1.7.5-1.7.9.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="mysql4-upgrade-1.7.6-1.7.9.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="uninstall-old-version.php" hash="4269e8547005958b044946d5e2d670e9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ICEshop_Iceimport.xml" hash="b94f339b79303bf7e78ba89290c66ada"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ice_import</name>
4
+ <version>1.7.13</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
7
  <channel>community</channel>
9
  <summary>Import categories &amp; productsr</summary>
10
  <description>This extension can use to import products with categories, multiple images and custom options from CSV file.</description>
11
  <notes>Improvements:&#xD;
12
+ - Added import errors indication.&#xD;
13
+ - Added grid for not imported images.&#xD;
14
+ - Added method to run only images import.&#xD;
15
+ - Added statistics import images.</notes>
16
  <authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
17
+ <date>2015-04-29</date>
18
+ <time>12:54:45</time>
19
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ICEshop_Iceimport.xml" hash="566089f8d3a54436ae62ebd4c5124293"/></dir><dir name="template"><dir name="iceshop"><dir name="iceimport"><file name="notifications.phtml" hash="3d9336ffcd90d11a34271d01b0b7fa9e"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir name="Block"><dir name="Adminhtml"><dir name="Images"><dir name="List"><file name="Grid.php" hash="93aec656c6751a65cfefc2f8ebf473b7"/></dir></dir><file name="Notifications.php" hash="4355538a30333b5c61cfe1550ae0129b"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="056987a5987c129ccaeff6c04df8678d"/><file name="Exportall.php" hash="c329655e2fc2d0983688699adc400976"/><file name="Updatebutton.php" hash="8400ab44d28d6bf95ddca6dd5a0bd73c"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fd9775a248481ddd683926452affb9ff"/><file name="Db.php" hash="564941a7ee03c28f46d282681c0c7c10"/><file name="Format.php" hash="5c56ce9db24076c52b198325fb637758"/><dir name="System"><file name="System.php" hash="ff58fc97338b95e165de85ef640147de"/><file name="Systemcheck.php" hash="e87560c1f4b5de926b0b1aa3f60411b3"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Product.php" hash="9281722241e6c4a8e3ec45a0383896c8"/></dir></dir><dir name="Dataflow"><dir name="Batch"><file name="Import.php" hash="52c0ed7367b2200a17a48103e953ae58"/></dir><dir name="Convert"><dir name="Parser"><file name="Csv.php" hash="052c8c5a800ab4a11c7ca60a45fd81ba"/></dir></dir></dir><file name="Observer.php" hash="64d712737e4d535d39d79127e2d02fb7"/><dir name="System"><dir name="Config"><file name="Checksystem.php" hash="260200dc8cecfa718b32fa47468282df"/><file name="Defaulttax.php" hash="898bf21060622bf8dc96469eb018c463"/><file name="Iceshoplink.php" hash="e77e62b0c00e2569ea5fdb0fb91ff90a"/><file name="Yesno.php" hash="59e349561a36e02f44b47301fce99ef5"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IceimagesController.php" hash="b43840720cb8fca823addc60402047ae"/><file name="IceimportController.php" hash="c36e98a83d726dbda41182af26f987a9"/><file name="IceimportimagesController.php" hash="441910744c4e8fb4e509caf5cc845a72"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2990ebf927b0476b7702731ad2979682"/><file name="config.xml" hash="20f10a52c443ee09685a85d53d58e7a0"/><file name="system.xml" hash="7d9ca6cae327ed02bebebaa54c686439"/></dir><dir name="sql"><dir name="iceimport_setup"><file name="mysql4-install-1.7.13" hash="e5b8e89aea9a674f0cd25718d5d62a1c"/><file name="mysql4-upgrade-0.1.0-1.7.0.php" hash="ff0682cde32b4f694bf1bed2c55a97f6"/><file name="mysql4-upgrade-1.4.0-1.7.0.php" hash="ff0682cde32b4f694bf1bed2c55a97f6"/><file name="mysql4-upgrade-1.5.0-1.7.0.php" hash="b51e20fdab764b90c6fd81551d9e368f"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="b51e20fdab764b90c6fd81551d9e368f"/><file name="mysql4-upgrade-1.6.0-1.7.5.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="mysql4-upgrade-1.7.5-1.7.9.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="mysql4-upgrade-1.7.6-1.7.9.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="mysql4-upgrade-1.7.9-1.7.13" hash="e5b8e89aea9a674f0cd25718d5d62a1c"/><file name="uninstall-old-version.php" hash="4269e8547005958b044946d5e2d670e9"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="ICEshop"><dir name="Iceimport"><file name="jquery-1.11.1.min.js" hash="056fd2a776eae867b7e2b5ddcb754d78"/><file name="script.js" hash="dabaaf1b4924cb8a2fd4e14de93f74e6"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iceshop"><dir name="iceimport"><dir name="images"><file name="iceshop_logo_small_16px.png" hash="4ef632b4b89a047789307b301b9dfb6e"/></dir><file name="styles.css" hash="0136e37ac22d82753fafec8294bc8555"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ICEshop_Iceimport.xml" hash="b94f339b79303bf7e78ba89290c66ada"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>