Version Notes
- Speed improvement
- Added option for updating of category to product relation
- Minor bug fixing
Download this release
Release Info
Developer | IceShop |
Extension | ice_import |
Version | 1.8.3 |
Comparing to | |
See all releases |
Code changes from version 1.8.0 to 1.8.3
- app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Iceimport.php +67 -35
- app/code/community/ICEshop/Iceimport/controllers/Adminhtml/System/Convert/GuiController.php +57 -1
- app/code/community/ICEshop/Iceimport/etc/config.xml +2 -1
- app/code/community/ICEshop/Iceimport/etc/system.xml +19 -9
- package.xml +8 -8
app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Iceimport.php
CHANGED
@@ -356,6 +356,8 @@ class Iceimport
|
|
356 |
|
357 |
$this->deleteTempFileForCatalogCategoryProductInsert();
|
358 |
|
|
|
|
|
359 |
$arValues = $this->addCatIdToArray($offset);
|
360 |
$columns = ['category_id', 'product_id'];
|
361 |
$fp = fopen($this->filenameValues, 'w+');
|
@@ -374,8 +376,10 @@ class Iceimport
|
|
374 |
return $elements['entity_id'];
|
375 |
}, $arValues);
|
376 |
|
377 |
-
if (
|
378 |
-
|
|
|
|
|
379 |
}
|
380 |
}
|
381 |
|
@@ -539,7 +543,7 @@ class Iceimport
|
|
539 |
|
540 |
$select_unspsc_id = $this->db_magento->query("SELECT attribute_id FROM `{$this->tablePrefix}eav_attribute` WHERE attribute_code = 'unspsc' AND entity_type_id = $category_entity_type;");
|
541 |
$unspsc_id = $select_unspsc_id->fetch()['attribute_id'];
|
542 |
-
$this->db_magento->query("INSERT INTO {$this->tablePrefix}catalog_category_entity (`entity_type_id`, `attribute_set_id`, `path`, `level`, `created_at`, `updated_at`) SELECT $category_entity_type, $attribute_set_id, tc.unspsc_path_c, tc.level, '$now', '$now' FROM {$this->tablePrefix}temp_cats tc WHERE unspsc_c NOT IN (SELECT value FROM {$this->tablePrefix}catalog_category_entity_varchar WHERE attribute_id = $unspsc_id) GROUP BY tc.unspsc_path_c;");
|
543 |
}
|
544 |
|
545 |
public function updateCategoryPath ()
|
@@ -686,7 +690,7 @@ class Iceimport
|
|
686 |
|
687 |
// categories
|
688 |
$categoriesConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_categories_from_csv');
|
689 |
-
$categoriesToActiveConf = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/category_active');
|
690 |
|
691 |
// mapping
|
692 |
$config_mpn = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_mpn');
|
@@ -736,20 +740,6 @@ FROM {$this->tablePrefix}import_feed impf WHERE sku NOT IN (SELECT sku FROM {$th
|
|
736 |
|
737 |
foreach ($value as $k => $attr) {
|
738 |
$front_input = false;
|
739 |
-
if ($attr == 'mpn' && !$productmpnConf ||
|
740 |
-
$attr == 'ean' && !$producteanConf ||
|
741 |
-
$attr == 'brand_name' && !$productbrandConf ||
|
742 |
-
$attr == 'delivery_eta' && !$deliveryetaConf ||
|
743 |
-
$attr == 'description' && !$productdescriptionConf ||
|
744 |
-
$attr == 'short_description' && !$productshdescriptionConf ||
|
745 |
-
$attr == 'visibility' && !$updateVisibilityFromCsvConf ||
|
746 |
-
$attr == 'url_key' && !$updateUrlKeyFromCsvConf ||
|
747 |
-
$attr == 'name' && !$productnameConf ||
|
748 |
-
$attr == 'price' && !$productpricesConf ||
|
749 |
-
$attr == 'status' && !$updateStatusFromCsvConf
|
750 |
-
) {
|
751 |
-
continue;
|
752 |
-
}
|
753 |
|
754 |
$attr_for_select = $attr;
|
755 |
|
@@ -844,9 +834,21 @@ FROM {$this->tablePrefix}import_feed impf WHERE sku NOT IN (SELECT sku FROM {$th
|
|
844 |
$counter++;
|
845 |
}
|
846 |
|
847 |
-
|
848 |
-
|
849 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
850 |
}
|
851 |
}
|
852 |
}
|
@@ -875,12 +877,18 @@ FROM {$this->tablePrefix}import_feed impf WHERE sku NOT IN (SELECT sku FROM {$th
|
|
875 |
if ($productstockConf) {
|
876 |
$this->db_magento->query("UPDATE {$this->tablePrefix}import_feed SET qty = 0 WHERE qty IS NULL;");
|
877 |
$this->db_magento->query("INSERT INTO {$this->tablePrefix}cataloginventory_stock_item (`product_id`, `stock_id`, `qty`, `is_in_stock`) SELECT impf.entity_id, $stock_id, impf.qty, impf.is_in_stock FROM {$this->tablePrefix}import_feed impf
|
878 |
-
ON DUPLICATE KEY UPDATE product_id = impf.entity_id, stock_id = $stock_id, qty = impf.qty;");
|
|
|
|
|
|
|
879 |
}
|
880 |
|
881 |
if ($updateIsInStockFromCsvConf) {
|
882 |
$this->db_magento->query("INSERT INTO {$this->tablePrefix}cataloginventory_stock_status (`product_id`, `website_id`, `stock_id`, `qty`, `stock_status`) SELECT impf.entity_id, $websiteId, $stock_id, impf.qty, impf.is_in_stock FROM {$this->tablePrefix}import_feed impf
|
883 |
ON DUPLICATE KEY UPDATE product_id = impf.entity_id, stock_id = $stock_id, website_id = $websiteId, qty = impf.qty;");
|
|
|
|
|
|
|
884 |
}
|
885 |
|
886 |
// Creating temp file for categories
|
@@ -911,28 +919,52 @@ ON DUPLICATE KEY UPDATE product_id = impf.entity_id, stock_id = $stock_id, websi
|
|
911 |
|
912 |
$this->updateCategoryPath();
|
913 |
|
914 |
-
if ($categoriesConf) {
|
915 |
// catalog_category_entity_varchar
|
916 |
-
|
917 |
-
|
|
|
|
|
|
|
918 |
|
919 |
-
|
920 |
-
$
|
|
|
|
|
|
|
|
|
|
|
921 |
}
|
922 |
|
923 |
-
|
|
|
|
|
|
|
|
|
|
|
924 |
$array_for_int = ['is_active' => $categoriesToActiveConf, 'is_anchor' => 1, 'include_in_menu' => 1];
|
|
|
|
|
|
|
|
|
|
|
925 |
|
926 |
-
|
|
|
927 |
|
928 |
-
|
929 |
-
|
930 |
|
931 |
-
|
932 |
-
$
|
|
|
|
|
|
|
|
|
933 |
}
|
934 |
-
}
|
935 |
|
|
|
|
|
|
|
936 |
// loading data to catalog_category_product;
|
937 |
$this->loadDataToCatalogCategoryProduct();
|
938 |
}
|
@@ -1006,7 +1038,7 @@ ON DUPLICATE KEY UPDATE product_id = impf.entity_id, stock_id = $stock_id, websi
|
|
1006 |
$ids_for_update_is_active = implode(',', $array_for_updating_is_active);
|
1007 |
|
1008 |
if (!empty($ids_for_update_is_active)) {
|
1009 |
-
|
1010 |
}
|
1011 |
}
|
1012 |
}
|
356 |
|
357 |
$this->deleteTempFileForCatalogCategoryProductInsert();
|
358 |
|
359 |
+
$categoriesToProductsConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_categories_to_product');
|
360 |
+
|
361 |
$arValues = $this->addCatIdToArray($offset);
|
362 |
$columns = ['category_id', 'product_id'];
|
363 |
$fp = fopen($this->filenameValues, 'w+');
|
376 |
return $elements['entity_id'];
|
377 |
}, $arValues);
|
378 |
|
379 |
+
if ($categoriesToProductsConf) {
|
380 |
+
if (!empty($final)) {
|
381 |
+
$this->db_magento->query("DELETE FROM {$this->tablePrefix}catalog_category_product WHERE product_id IN (" . implode(',', $final) . ");");
|
382 |
+
}
|
383 |
}
|
384 |
}
|
385 |
|
543 |
|
544 |
$select_unspsc_id = $this->db_magento->query("SELECT attribute_id FROM `{$this->tablePrefix}eav_attribute` WHERE attribute_code = 'unspsc' AND entity_type_id = $category_entity_type;");
|
545 |
$unspsc_id = $select_unspsc_id->fetch()['attribute_id'];
|
546 |
+
$this->db_magento->query("INSERT INTO {$this->tablePrefix}catalog_category_entity (`entity_type_id`, `attribute_set_id`, `path`, `level`, `children_count`, `position`, `created_at`, `updated_at`) SELECT $category_entity_type, $attribute_set_id, tc.unspsc_path_c, tc.level, 0, 1, '$now', '$now' FROM {$this->tablePrefix}temp_cats tc WHERE unspsc_c NOT IN (SELECT value FROM {$this->tablePrefix}catalog_category_entity_varchar WHERE attribute_id = $unspsc_id) GROUP BY tc.unspsc_path_c;");
|
547 |
}
|
548 |
|
549 |
public function updateCategoryPath ()
|
690 |
|
691 |
// categories
|
692 |
$categoriesConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_categories_from_csv');
|
693 |
+
$categoriesToActiveConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/category_active');
|
694 |
|
695 |
// mapping
|
696 |
$config_mpn = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_mpn');
|
740 |
|
741 |
foreach ($value as $k => $attr) {
|
742 |
$front_input = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
|
744 |
$attr_for_select = $attr;
|
745 |
|
834 |
$counter++;
|
835 |
}
|
836 |
|
837 |
+
if ($attr == 'mpn' && $productmpnConf ||
|
838 |
+
$attr == 'ean' && $producteanConf ||
|
839 |
+
$attr == 'brand_name' && $productbrandConf ||
|
840 |
+
$attr == 'delivery_eta' && $deliveryetaConf ||
|
841 |
+
$attr == 'description' && $productdescriptionConf ||
|
842 |
+
$attr == 'short_description' && $productshdescriptionConf ||
|
843 |
+
$attr == 'visibility' && $updateVisibilityFromCsvConf ||
|
844 |
+
$attr == 'url_key' && $updateUrlKeyFromCsvConf ||
|
845 |
+
$attr == 'name' && $productnameConf ||
|
846 |
+
$attr == 'price' && $productpricesConf ||
|
847 |
+
$attr == 'status' && $updateStatusFromCsvConf
|
848 |
+
) {
|
849 |
+
$this->db_magento->query("UPDATE {$this->tablePrefix}catalog_product_entity_{$post_fix} cpek JOIN {$this->tablePrefix}import_feed impf ON impf.entity_id = cpek.entity_id SET cpek.value = impf.$attr WHERE cpek.attribute_id = $attribute_id AND cpek.value <> impf.$attr AND cpek.store_id = impf.store AND cpek.entity_type_id = impf.entity_type_id;");
|
850 |
+
$this->db_magento->query("UPDATE {$this->tablePrefix}catalog_product_entity_{$post_fix} cpek JOIN {$this->tablePrefix}import_feed impf ON impf.entity_id = cpek.entity_id SET cpek.value = impf.$attr WHERE cpek.attribute_id = $attribute_id AND cpek.value <> impf.$attr AND cpek.store_id = 0 AND cpek.entity_type_id = impf.entity_type_id;");
|
851 |
+
}
|
852 |
}
|
853 |
}
|
854 |
}
|
877 |
if ($productstockConf) {
|
878 |
$this->db_magento->query("UPDATE {$this->tablePrefix}import_feed SET qty = 0 WHERE qty IS NULL;");
|
879 |
$this->db_magento->query("INSERT INTO {$this->tablePrefix}cataloginventory_stock_item (`product_id`, `stock_id`, `qty`, `is_in_stock`) SELECT impf.entity_id, $stock_id, impf.qty, impf.is_in_stock FROM {$this->tablePrefix}import_feed impf
|
880 |
+
ON DUPLICATE KEY UPDATE product_id = impf.entity_id, stock_id = $stock_id, qty = impf.qty, is_in_stock = impf.is_in_stock;");
|
881 |
+
} else {
|
882 |
+
$this->db_magento->query("INSERT INTO {$this->tablePrefix}cataloginventory_stock_item (`product_id`, `stock_id`, `qty`, `is_in_stock`) SELECT impf.entity_id, $stock_id, impf.qty, impf.is_in_stock FROM {$this->tablePrefix}import_feed impf
|
883 |
+
ON DUPLICATE KEY UPDATE product_id = impf.entity_id;");
|
884 |
}
|
885 |
|
886 |
if ($updateIsInStockFromCsvConf) {
|
887 |
$this->db_magento->query("INSERT INTO {$this->tablePrefix}cataloginventory_stock_status (`product_id`, `website_id`, `stock_id`, `qty`, `stock_status`) SELECT impf.entity_id, $websiteId, $stock_id, impf.qty, impf.is_in_stock FROM {$this->tablePrefix}import_feed impf
|
888 |
ON DUPLICATE KEY UPDATE product_id = impf.entity_id, stock_id = $stock_id, website_id = $websiteId, qty = impf.qty;");
|
889 |
+
} else {
|
890 |
+
$this->db_magento->query("INSERT INTO {$this->tablePrefix}cataloginventory_stock_status (`product_id`, `website_id`, `stock_id`, `qty`, `stock_status`) SELECT impf.entity_id, $websiteId, $stock_id, impf.qty, impf.is_in_stock FROM {$this->tablePrefix}import_feed impf
|
891 |
+
ON DUPLICATE KEY UPDATE product_id = impf.entity_id;");
|
892 |
}
|
893 |
|
894 |
// Creating temp file for categories
|
919 |
|
920 |
$this->updateCategoryPath();
|
921 |
|
|
|
922 |
// catalog_category_entity_varchar
|
923 |
+
$array_for_varchar = ['unspsc_c' => $unspsc_id, 'category' => $name_id, 'url_key' => $url_key_id];
|
924 |
+
foreach ($array_for_varchar as $attr_varchar => $attr_varchar_id) {
|
925 |
+
|
926 |
+
$store_def_query_varchar = "INSERT INTO {$this->tablePrefix}catalog_category_entity_varchar (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) SELECT $category_entity_type, $attr_varchar_id , tc.store, tc.id, tc.$attr_varchar FROM {$this->tablePrefix}temp_cats tc WHERE tc.id <> 0 ";
|
927 |
+
$store_null_query_varchar = "INSERT INTO {$this->tablePrefix}catalog_category_entity_varchar (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) SELECT $category_entity_type, $attr_varchar_id , 0, tc.id, tc.$attr_varchar FROM {$this->tablePrefix}temp_cats tc WHERE store = '$default_store_id' AND tc.id <> 0 ";
|
928 |
|
929 |
+
if ($categoriesConf) {
|
930 |
+
$store_def_query_varchar .= "ON DUPLICATE KEY UPDATE `value` = tc.$attr_varchar;";
|
931 |
+
$store_null_query_varchar .= "ON DUPLICATE KEY UPDATE `value` = tc.$attr_varchar;";
|
932 |
+
|
933 |
+
} else {
|
934 |
+
$store_def_query_varchar .= "ON DUPLICATE KEY UPDATE `entity_id` = tc.id;";
|
935 |
+
$store_null_query_varchar .= "ON DUPLICATE KEY UPDATE `entity_id` = tc.id;";
|
936 |
}
|
937 |
|
938 |
+
$this->db_magento->query($store_def_query_varchar);
|
939 |
+
$this->db_magento->query($store_null_query_varchar);
|
940 |
+
}
|
941 |
+
|
942 |
+
// catalog_category_entity_int
|
943 |
+
if ($categoriesToActiveConf) {
|
944 |
$array_for_int = ['is_active' => $categoriesToActiveConf, 'is_anchor' => 1, 'include_in_menu' => 1];
|
945 |
+
} else {
|
946 |
+
$array_for_int = ['is_anchor' => 1, 'include_in_menu' => 1];
|
947 |
+
}
|
948 |
+
|
949 |
+
foreach ($array_for_int as $attr_int => $int) {
|
950 |
|
951 |
+
$select_attribute_int = $this->db_magento->query("SELECT attribute_id FROM `{$this->tablePrefix}eav_attribute` WHERE attribute_code = '$attr_int' AND entity_type_id = $category_entity_type;");
|
952 |
+
$attribute_int = $select_attribute_int->fetch()['attribute_id'];
|
953 |
|
954 |
+
$store_def_query_int = "INSERT INTO {$this->tablePrefix}catalog_category_entity_int (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) SELECT $category_entity_type, $attribute_int , tc.store, tc.id, $int FROM {$this->tablePrefix}temp_cats tc WHERE tc.id <> 0 ";
|
955 |
+
$store_null_query_int = "INSERT INTO {$this->tablePrefix}catalog_category_entity_int (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) SELECT $category_entity_type, $attribute_int , 0, tc.id, $int FROM {$this->tablePrefix}temp_cats tc WHERE store = '$default_store_id' AND tc.id <> 0 ";
|
956 |
|
957 |
+
if ($categoriesConf && !$categoriesToActiveConf) {
|
958 |
+
$store_def_query_int .= "ON DUPLICATE KEY UPDATE `value` = $int;";
|
959 |
+
$store_null_query_int .= "ON DUPLICATE KEY UPDATE `value` = $int;";
|
960 |
+
} else {
|
961 |
+
$store_def_query_int .= "ON DUPLICATE KEY UPDATE `entity_id` = tc.id;";
|
962 |
+
$store_null_query_int .= "ON DUPLICATE KEY UPDATE `entity_id` = tc.id;";
|
963 |
}
|
|
|
964 |
|
965 |
+
$this->db_magento->query($store_def_query_int);
|
966 |
+
$this->db_magento->query($store_null_query_int);
|
967 |
+
}
|
968 |
// loading data to catalog_category_product;
|
969 |
$this->loadDataToCatalogCategoryProduct();
|
970 |
}
|
1038 |
$ids_for_update_is_active = implode(',', $array_for_updating_is_active);
|
1039 |
|
1040 |
if (!empty($ids_for_update_is_active)) {
|
1041 |
+
//$this->db_magento->query("UPDATE `{$this->tablePrefix}catalog_category_entity_int` SET `value` = 0 WHERE `attribute_id` = $attribute_is_active_id AND `entity_id` IN ($ids_for_update_is_active);");
|
1042 |
}
|
1043 |
}
|
1044 |
}
|
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/System/Convert/GuiController.php
CHANGED
@@ -54,11 +54,22 @@ class ICEshop_Iceimport_Adminhtml_System_Convert_GuiController extends Mage_Admi
|
|
54 |
|
55 |
$iceimport = new Iceimport();
|
56 |
|
57 |
-
|
|
|
|
|
|
|
58 |
|
|
|
59 |
$iceimport->importProduct($importData);
|
60 |
} catch (Exception $e) {
|
|
|
|
|
|
|
|
|
|
|
61 |
$errors[] = $e->getMessage();
|
|
|
|
|
62 |
}
|
63 |
|
64 |
if (method_exists($adapter, 'getEventPrefix')) {
|
@@ -83,11 +94,35 @@ class ICEshop_Iceimport_Adminhtml_System_Convert_GuiController extends Mage_Admi
|
|
83 |
}
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
public function batchFinishAction()
|
87 |
{
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
$DB_logger = Mage::helper('iceimport/db');
|
90 |
$delete_old_products = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products');
|
|
|
91 |
|
92 |
$batchId = $this->getRequest()->getParam('id');
|
93 |
if ($batchId) {
|
@@ -107,9 +142,30 @@ class ICEshop_Iceimport_Adminhtml_System_Convert_GuiController extends Mage_Admi
|
|
107 |
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
108 |
}
|
109 |
}
|
|
|
|
|
|
|
|
|
|
|
110 |
if ($delete_old_products) {
|
111 |
$iceimport = new Iceimport();
|
112 |
$iceimport->deleteOldProducts($DB_logger);
|
113 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
}
|
54 |
|
55 |
$iceimport = new Iceimport();
|
56 |
|
57 |
+
$date = date('m/d/Y H:i:s');
|
58 |
+
|
59 |
+
$DB_logger = Mage::helper('iceimport/db');
|
60 |
+
$DB_logger->insertLogEntry('iceimport_import_started', $date);
|
61 |
|
62 |
+
try {
|
63 |
$iceimport->importProduct($importData);
|
64 |
} catch (Exception $e) {
|
65 |
+
$iceimport->deleteTemFileForAttributes();
|
66 |
+
$iceimport->deleteTempFileForCategories();
|
67 |
+
$iceimport->deleteTempFileForCatalogCategoryProductInsert();
|
68 |
+
$iceimport->deleteTempTableCats();
|
69 |
+
$iceimport->deleteTempTableProds();
|
70 |
$errors[] = $e->getMessage();
|
71 |
+
$date = date('m/d/Y H:i:s');
|
72 |
+
$DB_logger->insertLogEntry('iceimport_import_ended', $date);
|
73 |
}
|
74 |
|
75 |
if (method_exists($adapter, 'getEventPrefix')) {
|
94 |
}
|
95 |
}
|
96 |
|
97 |
+
/**
|
98 |
+
* Update path to children category/root
|
99 |
+
*/
|
100 |
+
public function updateCatalogCategoryChildren(){
|
101 |
+
try{
|
102 |
+
$db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
|
103 |
+
$tablePrefix = '';
|
104 |
+
$tPrefix = (array)Mage::getConfig()->getTablePrefix();
|
105 |
+
if (!empty($tPrefix)) {
|
106 |
+
$tablePrefix = $tPrefix[0];
|
107 |
+
}
|
108 |
+
$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,"/%"));');
|
109 |
+
} catch (Exception $e){
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
public function batchFinishAction()
|
114 |
{
|
115 |
|
116 |
+
$db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
|
117 |
+
$tablePrefix = '';
|
118 |
+
$tPrefix = (array)Mage::getConfig()->getTablePrefix();
|
119 |
+
if (!empty($tPrefix)) {
|
120 |
+
$tablePrefix = $tPrefix[0];
|
121 |
+
}
|
122 |
+
|
123 |
$DB_logger = Mage::helper('iceimport/db');
|
124 |
$delete_old_products = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products');
|
125 |
+
$category_sort = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/category_sort');
|
126 |
|
127 |
$batchId = $this->getRequest()->getParam('id');
|
128 |
if ($batchId) {
|
142 |
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
143 |
}
|
144 |
}
|
145 |
+
|
146 |
+
$select_count_imported_products = $db_res->query("SELECT COUNT(DISTINCT product_sku) as count FROM {$tablePrefix}iceshop_iceimport_imported_product_ids WHERE product_sku IS NOT NULL;");
|
147 |
+
$count_imported_products = $select_count_imported_products->fetch()['count'];
|
148 |
+
$DB_logger->insertLogEntry('iceimport_count_imported_products', $count_imported_products);
|
149 |
+
|
150 |
if ($delete_old_products) {
|
151 |
$iceimport = new Iceimport();
|
152 |
$iceimport->deleteOldProducts($DB_logger);
|
153 |
}
|
154 |
+
|
155 |
+
if ($category_sort) {
|
156 |
+
if (!isset($iceimport)) {
|
157 |
+
$iceimport = new Iceimport();
|
158 |
+
}
|
159 |
+
$iceimport->runCategoriesSorting();
|
160 |
+
}
|
161 |
+
try {
|
162 |
+
$this->updateCatalogCategoryChildren();
|
163 |
+
$db_res->query("TRUNCATE {$tablePrefix}dataflow_batch_import");
|
164 |
+
} catch (Exception $e) {
|
165 |
+
$DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
|
166 |
+
throw new Exception($e->getMessage());
|
167 |
+
}
|
168 |
+
$date = date('m/d/Y H:i:s');
|
169 |
+
$DB_logger->insertLogEntry('iceimport_import_ended', $date);
|
170 |
}
|
171 |
}
|
app/code/community/ICEshop/Iceimport/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<ICEshop_Iceimport>
|
5 |
-
<version>1.8.
|
6 |
</ICEshop_Iceimport>
|
7 |
</modules>
|
8 |
<admin>
|
@@ -128,6 +128,7 @@
|
|
128 |
<import_images>1</import_images>
|
129 |
<process_image_queue>0</process_image_queue>
|
130 |
<update_categories_from_csv>1</update_categories_from_csv>
|
|
|
131 |
<update_status_from_csv>1</update_status_from_csv>
|
132 |
<update_visibility_from_csv>1</update_visibility_from_csv>
|
133 |
<update_is_in_stock_from_csv>1</update_is_in_stock_from_csv>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<ICEshop_Iceimport>
|
5 |
+
<version>1.8.3</version>
|
6 |
</ICEshop_Iceimport>
|
7 |
</modules>
|
8 |
<admin>
|
128 |
<import_images>1</import_images>
|
129 |
<process_image_queue>0</process_image_queue>
|
130 |
<update_categories_from_csv>1</update_categories_from_csv>
|
131 |
+
<update_categories_to_product>1</update_categories_to_product>
|
132 |
<update_status_from_csv>1</update_status_from_csv>
|
133 |
<update_visibility_from_csv>1</update_visibility_from_csv>
|
134 |
<update_is_in_stock_from_csv>1</update_is_in_stock_from_csv>
|
app/code/community/ICEshop/Iceimport/etc/system.xml
CHANGED
@@ -153,12 +153,22 @@
|
|
153 |
<show_in_website>1</show_in_website>
|
154 |
<show_in_store>1</show_in_store>
|
155 |
</update_categories_from_csv>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
<update_status_from_csv translate="label">
|
157 |
<label><![CDATA[Update status]]></label>
|
158 |
<comment><![CDATA[]]></comment>
|
159 |
<frontend_type>select</frontend_type>
|
160 |
<source_model>iceimport/system_config_yesno</source_model>
|
161 |
-
<sort_order>
|
162 |
<show_in_default>1</show_in_default>
|
163 |
<show_in_website>1</show_in_website>
|
164 |
<show_in_store>1</show_in_store>
|
@@ -168,7 +178,7 @@
|
|
168 |
<comment><![CDATA[]]></comment>
|
169 |
<frontend_type>select</frontend_type>
|
170 |
<source_model>iceimport/system_config_yesno</source_model>
|
171 |
-
<sort_order>
|
172 |
<show_in_default>1</show_in_default>
|
173 |
<show_in_website>1</show_in_website>
|
174 |
<show_in_store>1</show_in_store>
|
@@ -178,7 +188,7 @@
|
|
178 |
<comment><![CDATA[]]></comment>
|
179 |
<frontend_type>select</frontend_type>
|
180 |
<source_model>iceimport/system_config_yesno</source_model>
|
181 |
-
<sort_order>
|
182 |
<show_in_default>1</show_in_default>
|
183 |
<show_in_website>1</show_in_website>
|
184 |
<show_in_store>1</show_in_store>
|
@@ -188,7 +198,7 @@
|
|
188 |
<comment><![CDATA[]]></comment>
|
189 |
<frontend_type>select</frontend_type>
|
190 |
<source_model>iceimport/system_config_yesno</source_model>
|
191 |
-
<sort_order>
|
192 |
<show_in_default>1</show_in_default>
|
193 |
<show_in_website>1</show_in_website>
|
194 |
<show_in_store>1</show_in_store>
|
@@ -197,7 +207,7 @@
|
|
197 |
<label>Import product images (via Cron)</label>
|
198 |
<frontend_type>select</frontend_type>
|
199 |
<source_model>iceimport/system_config_yesno</source_model>
|
200 |
-
<sort_order>
|
201 |
<show_in_default>1</show_in_default>
|
202 |
<show_in_website>1</show_in_website>
|
203 |
<show_in_store>1</show_in_store>
|
@@ -206,7 +216,7 @@
|
|
206 |
<label>Run image queue processing</label>
|
207 |
<frontend_type>select</frontend_type>
|
208 |
<source_model>iceimport/system_config_yesno</source_model>
|
209 |
-
<sort_order>
|
210 |
<show_in_default>1</show_in_default>
|
211 |
<show_in_website>1</show_in_website>
|
212 |
<show_in_store>1</show_in_store>
|
@@ -216,7 +226,7 @@
|
|
216 |
<comment>Choose run re-index all the content after finishing ICEimport or not.</comment>
|
217 |
<frontend_type>select</frontend_type>
|
218 |
<source_model>iceimport/system_config_yesno</source_model>
|
219 |
-
<sort_order>
|
220 |
<show_in_default>1</show_in_default>
|
221 |
<show_in_website>1</show_in_website>
|
222 |
<show_in_store>1</show_in_store>
|
@@ -226,7 +236,7 @@
|
|
226 |
<comment><![CDATA[Import profile]]></comment>
|
227 |
<frontend_type>select</frontend_type>
|
228 |
<source_model>iceimport/system_config_profiles</source_model>
|
229 |
-
<sort_order>
|
230 |
<show_in_default>1</show_in_default>
|
231 |
<show_in_website>1</show_in_website>
|
232 |
<show_in_store>1</show_in_store>
|
@@ -234,7 +244,7 @@
|
|
234 |
<cron_settings>
|
235 |
<label>When you want to run cron ?</label>
|
236 |
<frontend_type>text</frontend_type>
|
237 |
-
<sort_order>
|
238 |
<validate>required-entry</validate>
|
239 |
<comment>Use Crontab Format (Eg. "30 7 * * *" in 7:30 AM). Don't forget `Flush Magento Cache` and `Flush Cache Storage` after changes.</comment>
|
240 |
<show_in_default>1</show_in_default>
|
153 |
<show_in_website>1</show_in_website>
|
154 |
<show_in_store>1</show_in_store>
|
155 |
</update_categories_from_csv>
|
156 |
+
<update_categories_to_product translate="label">
|
157 |
+
<label><![CDATA[Update products to categories]]></label>
|
158 |
+
<comment><![CDATA[]]></comment>
|
159 |
+
<frontend_type>select</frontend_type>
|
160 |
+
<source_model>iceimport/system_config_yesno</source_model>
|
161 |
+
<sort_order>33</sort_order>
|
162 |
+
<show_in_default>1</show_in_default>
|
163 |
+
<show_in_website>1</show_in_website>
|
164 |
+
<show_in_store>1</show_in_store>
|
165 |
+
</update_categories_to_product>
|
166 |
<update_status_from_csv translate="label">
|
167 |
<label><![CDATA[Update status]]></label>
|
168 |
<comment><![CDATA[]]></comment>
|
169 |
<frontend_type>select</frontend_type>
|
170 |
<source_model>iceimport/system_config_yesno</source_model>
|
171 |
+
<sort_order>34</sort_order>
|
172 |
<show_in_default>1</show_in_default>
|
173 |
<show_in_website>1</show_in_website>
|
174 |
<show_in_store>1</show_in_store>
|
178 |
<comment><![CDATA[]]></comment>
|
179 |
<frontend_type>select</frontend_type>
|
180 |
<source_model>iceimport/system_config_yesno</source_model>
|
181 |
+
<sort_order>35</sort_order>
|
182 |
<show_in_default>1</show_in_default>
|
183 |
<show_in_website>1</show_in_website>
|
184 |
<show_in_store>1</show_in_store>
|
188 |
<comment><![CDATA[]]></comment>
|
189 |
<frontend_type>select</frontend_type>
|
190 |
<source_model>iceimport/system_config_yesno</source_model>
|
191 |
+
<sort_order>36</sort_order>
|
192 |
<show_in_default>1</show_in_default>
|
193 |
<show_in_website>1</show_in_website>
|
194 |
<show_in_store>1</show_in_store>
|
198 |
<comment><![CDATA[]]></comment>
|
199 |
<frontend_type>select</frontend_type>
|
200 |
<source_model>iceimport/system_config_yesno</source_model>
|
201 |
+
<sort_order>37</sort_order>
|
202 |
<show_in_default>1</show_in_default>
|
203 |
<show_in_website>1</show_in_website>
|
204 |
<show_in_store>1</show_in_store>
|
207 |
<label>Import product images (via Cron)</label>
|
208 |
<frontend_type>select</frontend_type>
|
209 |
<source_model>iceimport/system_config_yesno</source_model>
|
210 |
+
<sort_order>38</sort_order>
|
211 |
<show_in_default>1</show_in_default>
|
212 |
<show_in_website>1</show_in_website>
|
213 |
<show_in_store>1</show_in_store>
|
216 |
<label>Run image queue processing</label>
|
217 |
<frontend_type>select</frontend_type>
|
218 |
<source_model>iceimport/system_config_yesno</source_model>
|
219 |
+
<sort_order>39</sort_order>
|
220 |
<show_in_default>1</show_in_default>
|
221 |
<show_in_website>1</show_in_website>
|
222 |
<show_in_store>1</show_in_store>
|
226 |
<comment>Choose run re-index all the content after finishing ICEimport or not.</comment>
|
227 |
<frontend_type>select</frontend_type>
|
228 |
<source_model>iceimport/system_config_yesno</source_model>
|
229 |
+
<sort_order>40</sort_order>
|
230 |
<show_in_default>1</show_in_default>
|
231 |
<show_in_website>1</show_in_website>
|
232 |
<show_in_store>1</show_in_store>
|
236 |
<comment><![CDATA[Import profile]]></comment>
|
237 |
<frontend_type>select</frontend_type>
|
238 |
<source_model>iceimport/system_config_profiles</source_model>
|
239 |
+
<sort_order>41</sort_order>
|
240 |
<show_in_default>1</show_in_default>
|
241 |
<show_in_website>1</show_in_website>
|
242 |
<show_in_store>1</show_in_store>
|
244 |
<cron_settings>
|
245 |
<label>When you want to run cron ?</label>
|
246 |
<frontend_type>text</frontend_type>
|
247 |
+
<sort_order>42</sort_order>
|
248 |
<validate>required-entry</validate>
|
249 |
<comment>Use Crontab Format (Eg. "30 7 * * *" in 7:30 AM). Don't forget `Flush Magento Cache` and `Flush Cache Storage` after changes.</comment>
|
250 |
<show_in_default>1</show_in_default>
|
package.xml
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ice_import</name>
|
4 |
-
<version>1.8.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Import categories & products</summary>
|
10 |
<description>This extension can use to import products with categories, multiple images and custom options from CSV file.</description>
|
11 |
-
<notes>-
|
12 |
-
-
|
13 |
-
-
|
14 |
<authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
|
15 |
-
<date>2017-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir name="Block"><dir name="Adminhtml"><file name="Dashboard.php" hash="2eee914402e5610ba273109994e6ca6a"/><dir name="Images"><dir name="List"><file name="Grid.php" hash="e3c9190844dd7d829ec8c95a3edb53a9"/></dir></dir><file name="Notifications.php" hash="2c917dd62d7119cc0f5b3fda87efc537"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="a716ac837c2a3548c2b0c8ab7d871321"/><file name="Exportall.php" hash="38bbe2ec93f492230f2ffcee56dd259b"/><file name="Updatebutton.php" hash="bf0344ecdb7b2756f10830c51324f5a2"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="29b0d1ddc50a67eaf7160cf1228f24da"/><file name="Db.php" hash="e4214f988bc3e030ad1f73f275453aaf"/><file name="Format.php" hash="20e0c6e3be6ce66b5c5fa2091fe04f4a"/><dir name="System"><file name="System.php" hash="2645d278ecfdd0bcb2bfaf4a9c8ea53e"/><file name="Systemcheck.php" hash="8b4916b33bf1b92610e01758b8f4492f"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Iceimport.php" hash="
|
18 |
<compatible/>
|
19 |
-
<dependencies><required><php><min>5.2.0</min><max>7.1.
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ice_import</name>
|
4 |
+
<version>1.8.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Import categories & products</summary>
|
10 |
<description>This extension can use to import products with categories, multiple images and custom options from CSV file.</description>
|
11 |
+
<notes>- Speed improvement
|
12 |
+
- Added option for updating of category to product relation
|
13 |
+
- Minor bug fixing</notes>
|
14 |
<authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
|
15 |
+
<date>2017-09-04</date>
|
16 |
+
<time>16:04:56</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir name="Block"><dir name="Adminhtml"><file name="Dashboard.php" hash="2eee914402e5610ba273109994e6ca6a"/><dir name="Images"><dir name="List"><file name="Grid.php" hash="e3c9190844dd7d829ec8c95a3edb53a9"/></dir></dir><file name="Notifications.php" hash="2c917dd62d7119cc0f5b3fda87efc537"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="a716ac837c2a3548c2b0c8ab7d871321"/><file name="Exportall.php" hash="38bbe2ec93f492230f2ffcee56dd259b"/><file name="Updatebutton.php" hash="bf0344ecdb7b2756f10830c51324f5a2"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="29b0d1ddc50a67eaf7160cf1228f24da"/><file name="Db.php" hash="e4214f988bc3e030ad1f73f275453aaf"/><file name="Format.php" hash="20e0c6e3be6ce66b5c5fa2091fe04f4a"/><dir name="System"><file name="System.php" hash="2645d278ecfdd0bcb2bfaf4a9c8ea53e"/><file name="Systemcheck.php" hash="8b4916b33bf1b92610e01758b8f4492f"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Iceimport.php" hash="716663f78e180d55310feeab741f6ec1"/></dir></dir><dir name="Dataflow"><dir name="Batch"><file name="Import.php" hash="b47a93c74ce8c785ad69eb47803ef3db"/></dir><dir name="Convert"><dir name="Adapter"><file name="Io.php" hash="0fc5cdfdce12eda0553711355b3c2405"/></dir><dir name="Parser"><file name="Csv.php" hash="c031459fe50a569fbe655262ef286c40"/></dir></dir></dir><file name="Observer.php" hash="1d4ea7dbd0f707071e8a77f24049bfd4"/><dir name="System"><dir name="Config"><file name="Category.php" hash="d20fe0979a1ed5d56a1e91374d0f566b"/><file name="Checksystem.php" hash="86cda2191bea190d59bdfaf904cd55fd"/><file name="Defaulttax.php" hash="2baea942efcc3880d785da9f021f04fc"/><file name="Explanations.php" hash="5452b370335ef4c03272c11c527e4ca3"/><dir name="Fields"><file name="Attributes.php" hash="e493e1f8a09aee4e5e603b292ac17fef"/></dir><file name="Iceshoplink.php" hash="5a5b523ab4bb13ad8f94c82f321ba19e"/><file name="Profiles.php" hash="6f8525946e12b116c7c2435c74b82e43"/><file name="Stock.php" hash="db933dc508d917904915771de54a998c"/><file name="Websites.php" hash="de666d4e92f777646839e73717e20fd3"/><file name="Yesno.php" hash="273e501e78300ac78360fd787d5f9d1b"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IceimagesController.php" hash="4ab35558c030e353a54cfe64b3d81df1"/><file name="IceimportController.php" hash="13505b537014587f3178a920b30d63bb"/><file name="IceimportimagesController.php" hash="51d383100bf1b6a4fc97866f0e0a51bb"/><dir name="System"><dir name="Convert"><file name="GuiController.php" hash="bd04455d17bbb5b142b20ce69e642a7e"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aae63620174bbe5791cad5ce154eb8da"/><file name="config.xml" hash="d1ddebe204e2287a05a4248a86a77090"/><file name="system.xml" hash="524cc85326de40e10bd26ff36b9f9d72"/></dir><file name="include.php" hash="4feef8b32dce3375a9d48f817a90c396"/><dir name="sql"><dir name="iceimport_setup"><file name="mysql4-install-1.8.0.php" hash="4f3769e113bf3359d8e31e7ed541f6df"/><file name="mysql4-upgrade-1.7.15-1.8.0.php" hash="51e7eab2a26c9521b3ee1463b66adadd"/><file name="mysql4-upgrade-1.7.16-1.8.0.php" hash="e82b29207bc0bb92b15bdea5b60c071d"/><file name="mysql4-upgrade-1.7.17-1.8.0.php" hash="f6b22ec5557cb2b0e5f6aa469c034937"/><file name="mysql4-upgrade-1.7.18-1.8.0.php" hash="8e6fbf57ebe0a1f38ac8bcbf64eee746"/><file name="mysql4-upgrade-1.7.19-1.8.0.php" hash="7c03da0f59ead15cb1e0a0f7ee2d5d28"/><file name="mysql4-upgrade-1.7.20-1.8.0.php" hash="ac6d4efbd15ba801242635c43ce24270"/><file name="mysql4-upgrade-1.7.21-1.8.0.php" hash="0e7237d0cc4bae04d2f5b931cbc9f5ba"/><file name="mysql4-upgrade-1.7.22-1.8.0.php" hash="0e7237d0cc4bae04d2f5b931cbc9f5ba"/><file name="mysql4-upgrade-1.7.8-1.8.0.php" hash="361c8fe17ee33d289094fc252501f7a1"/><file name="upgrade_run.php" hash="f77e33b196d987239f7b3176bed27e90"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ICEshop_Iceimport.xml" hash="ba688dd33def1bb1c1c3f6d312eff468"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ICEshop_Iceimport.xml" hash="af53e1e9c59f2e351ec75e6b2a452360"/></dir><dir name="template"><dir name="iceshop"><dir name="iceimport"><file name="dashboard.phtml" hash="0fb362cb59eaff591b8b33e812798986"/><file name="notifications.phtml" hash="d41bd462ebfee9392a086530dfd13c55"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="ICEshop"><dir name="Iceimport"><file name="dashboard.js" hash="54ebceb6b8be6a0cc8f012248a5ea1ba"/><file name="jquery-1.11.1.min.js" hash="00581ba93329e1af4e422831174588f9"/><file name="script.js" hash="3c00573b09de4b67d0776dccb5acf139"/></dir></dir></dir></target><target name="mageskin"><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="dfde1444b1d962bae2e0b8f0a7076334"/></dir></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>7.1.9</max></php></required></dependencies>
|
20 |
</package>
|