From 59c6f81762de3a781afd72932b55847b921c8915 Mon Sep 17 00:00:00 2001 From: bestshow Date: Tue, 28 Mar 2017 14:57:34 +0800 Subject: [PATCH 1/9] Update ajax_gettime.php --- magmi/web/ajax_gettime.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magmi/web/ajax_gettime.php b/magmi/web/ajax_gettime.php index 7798203d..ec8a6ccd 100644 --- a/magmi/web/ajax_gettime.php +++ b/magmi/web/ajax_gettime.php @@ -1,2 +1,2 @@ Date: Tue, 28 Mar 2017 23:21:47 +0800 Subject: [PATCH 2/9] Update ajax_gettime.php --- magmi/web/ajax_gettime.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magmi/web/ajax_gettime.php b/magmi/web/ajax_gettime.php index ec8a6ccd..d1a2a000 100644 --- a/magmi/web/ajax_gettime.php +++ b/magmi/web/ajax_gettime.php @@ -1,2 +1,2 @@ Date: Tue, 9 May 2017 18:31:16 +0200 Subject: [PATCH 3/9] Fix category product position Fix category product position when base category tree is setted on plugin configuration o some category not have ::x::x::x If Base category or some category not have ::x::x::x set array $catpos is not in sync with $catids array (see line 375) and category position not working correctly. --- .../plugins/extra/itemprocessors/categories/categoryimport.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/magmi/plugins/extra/itemprocessors/categories/categoryimport.php b/magmi/plugins/extra/itemprocessors/categories/categoryimport.php index cadaf79d..fd227fab 100644 --- a/magmi/plugins/extra/itemprocessors/categories/categoryimport.php +++ b/magmi/plugins/extra/itemprocessors/categories/categoryimport.php @@ -304,6 +304,8 @@ public function getCategoryIdsFromDef($pcatdef, $srdefs, $item) } else { $catpos[] = "0"; } + } else { + $catpos[] = "0"; } $translation_option = array_values(array_filter($a, function ($option) { return stripos($option, '[') === 0; })); $translation_option_part = count($translation_option) ? '::' . $translation_option[0] : ''; From c7f53dcda1ad5fc807c7601d11f95973d912f143 Mon Sep 17 00:00:00 2001 From: Hidayet Ok Date: Thu, 8 Jun 2017 16:58:25 +0300 Subject: [PATCH 4/9] null equality issue if ($ovalue !== false && $ovalue != null) returns wrong result in php 5.6.30 and sets $ovalue as false --- magmi/engines/magmi_productimportengine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magmi/engines/magmi_productimportengine.php b/magmi/engines/magmi_productimportengine.php index cbdd613f..cf0070aa 100755 --- a/magmi/engines/magmi_productimportengine.php +++ b/magmi/engines/magmi_productimportengine.php @@ -1678,7 +1678,7 @@ public function createAttributes($pid, &$item, $attmap, $isnew, $itemids) } } // if we have something to do with this value - if ($ovalue !== false && $ovalue != null) + if ($ovalue !== false && $ovalue !== null) { $data[] = $this->getProductEntityType(); $data[] = $attid; From e352ebc1655a8b4007471f09bec16c4d60cff9ed Mon Sep 17 00:00:00 2001 From: Sebastien Bracquemont Date: Thu, 26 Oct 2017 14:02:23 +0200 Subject: [PATCH 5/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9bb18c7a..04beb0a5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Join the chat at https://gitter.im/dweeves/magmi-git](https://badges.gitter.im/dweeves/magmi-git.svg)](https://gitter.im/dweeves/magmi-git?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](dweeves@gmail.com) magmi-git 0.7.23 === From 2adca1daced76f5388d2f256bac8aa7063121946 Mon Sep 17 00:00:00 2001 From: Sebastien Bracquemont Date: Thu, 26 Oct 2017 17:21:15 +0200 Subject: [PATCH 6/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04beb0a5..f8022366 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Join the chat at https://gitter.im/dweeves/magmi-git](https://badges.gitter.im/dweeves/magmi-git.svg)](https://gitter.im/dweeves/magmi-git?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](dweeves@gmail.com) +[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FCTC7R3YUJVPQ) magmi-git 0.7.23 === From 8fae4fdee2b6982fd71e960e23126a070086ec21 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Tue, 18 Sep 2018 16:22:15 +0100 Subject: [PATCH 7/9] Use strict comparison when comparing values A value of int(0) was being converted to null. This fixes that error. --- magmi/engines/magmi_productimportengine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magmi/engines/magmi_productimportengine.php b/magmi/engines/magmi_productimportengine.php index cf0070aa..37cde4ef 100755 --- a/magmi/engines/magmi_productimportengine.php +++ b/magmi/engines/magmi_productimportengine.php @@ -1684,7 +1684,7 @@ public function createAttributes($pid, &$item, $attmap, $isnew, $itemids) $data[] = $attid; $data[] = $store_id; $data[] = $pid; - $data[] = $ovalue == '__NULL__' ? null : $ovalue; + $data[] = $ovalue === '__NULL__' ? null : $ovalue; $insstr = "(?,?,?,?,?)"; $inserts[] = $insstr; } From 54b7fa6bae6cac9f5133afeb2b0cc7ccbbc3d59e Mon Sep 17 00:00:00 2001 From: yangwb1 <770260332@qq.com> Date: Thu, 27 Dec 2018 15:28:05 +0800 Subject: [PATCH 8/9] fix bundle products import issue: Field `parent_product_id` doesn not have a default value --- .../itemprocessors/bundle/limora_bundleprocessor.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/magmi/plugins/base/itemprocessors/bundle/limora_bundleprocessor.php b/magmi/plugins/base/itemprocessors/bundle/limora_bundleprocessor.php index e592c59e..cd46d778 100755 --- a/magmi/plugins/base/itemprocessors/bundle/limora_bundleprocessor.php +++ b/magmi/plugins/base/itemprocessors/bundle/limora_bundleprocessor.php @@ -163,9 +163,9 @@ protected function _createOptions($item, $params) if (!empty($option['title'])) { if (empty($existingOption['title'])) { - $sql = "INSERT INTO $optv (option_id, store_id, title) VALUES(:option_id, :store_id, :title)"; + $sql = "INSERT INTO $optv (option_id, store_id, title,parent_product_id) VALUES(:option_id, :store_id, :title, :parent_product_id)"; $bind = array('option_id'=>$option['option_id'],'store_id'=>$option['store_id'], - 'title'=>$option['title']); + 'title'=>$option['title'],'parent_product_id' => $option['parent_id']); $this->insert($sql, $bind); } elseif ($existingOption['title'] != $option['title']) { $sql = "UPDATE $optv SET title = :title WHERE option_id = :option_id AND store_id = :store_id"; @@ -181,13 +181,13 @@ protected function _createOptions($item, $params) $optionId = $this->insert($sql, $bind); $option['option_id'] = $optionId; - $sql = "INSERT INTO $optv (option_id, store_id, title) VALUES(:option_id, :store_id, :title)"; - $bind = array('option_id'=>$option['option_id'],'store_id'=>0,'title'=>$option['code']); + $sql = "INSERT INTO $optv (option_id, store_id, title, parent_product_id) VALUES(:option_id, :store_id, :title, :parent_product_id)"; + $bind = array('option_id'=>$option['option_id'],'store_id'=>0,'title'=>$option['code'],'parent_product_id' => $option['parent_id']); $this->insert($sql, $bind); if (!empty($option['title']) && $option['store_id'] != 0) { $bind = array('option_id'=>$option['option_id'],'store_id'=>$option['store_id'], - 'title'=>$option['title']); + 'title'=>$option['title'],'parent_product_id' => $option['parent_id']); $this->insert($sql, $bind); } } From d006ad195c0802103d22e7d4a8da477739dd9600 Mon Sep 17 00:00:00 2001 From: bertod Date: Mon, 10 Feb 2020 13:30:57 +0100 Subject: [PATCH 9/9] bug fix query import category translation --- .../categories/categoryimport.php | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/magmi/plugins/extra/itemprocessors/categories/categoryimport.php b/magmi/plugins/extra/itemprocessors/categories/categoryimport.php index fd227fab..7f272904 100644 --- a/magmi/plugins/extra/itemprocessors/categories/categoryimport.php +++ b/magmi/plugins/extra/itemprocessors/categories/categoryimport.php @@ -42,7 +42,7 @@ public function initialize($params) public function initStores() { - $sql = 'SELECT store_id AS id, code FROM ' . $this->tablename('core_store'); + $sql = 'SELECT store_id AS id, code FROM ' . $this->tablename('store'); $stores = $this->selectAll($sql, null, 'code'); $this->stores = array_reduce($stores, function ($result, $store) { $result[$store['code']] = $store['id']; @@ -56,31 +56,27 @@ public function initStores() */ public function initCats() { - // zioigor - 20110426 missing call to tablename method for table_prfix - $t = $this->tablename("catalog_category_entity"); - $csg = $this->tablename("core_store_group"); - $cs = $this->tablename("core_store"); - $ccev = $t . "_varchar"; - $ea = $this->tablename("eav_attribute"); + + $t = $this->tablename("catalog_category_entity"); + $csg = $this->tablename("store_group"); + $cs = $this->tablename("store"); + $ccev = $t . "_varchar"; + $ea = $this->tablename("eav_attribute"); $result = $this->selectAll( - "SELECT cs.store_id,csg.website_id,cce.entity_type_id,cce.path,ccev.value as name - FROM $cs as cs - JOIN $csg as csg on csg.group_id=cs.group_id - JOIN $t as cce ON cce.entity_id=csg.root_category_id - JOIN $ea as ea ON ea.attribute_code='name' AND ea.entity_type_id=cce.entity_type_id - JOIN $ccev as ccev ON ccev.attribute_id=ea.attribute_id AND ccev.entity_id=cce.entity_id - "); + "SELECT cs.store_id,csg.website_id,cce.path,ccev.value as name + FROM $cs as cs + JOIN $csg as csg on csg.group_id=cs.group_id + JOIN $t as cce ON cce.entity_id=csg.root_category_id + JOIN $ea as ea ON ea.attribute_code='name' + JOIN $ccev as ccev ON ccev.attribute_id=ea.attribute_id AND ccev.entity_id=cce.entity_id + "); foreach ($result as $row) { - $rootinfo = array( - "path" => $row["path"], - "etid" => $row["entity_type_id"], - "name" => $row["name"], - "rootarr" => explode("/", $row["path"]) - ); + $rootinfo = array("path"=>$row["path"],"name"=>$row["name"], + "rootarr"=>explode("/", $row["path"])); $this->_catroots[$row["store_id"]] = $rootinfo; $this->_catrootw[$row["website_id"]][] = $row["store_id"]; if ($this->_cat_eid == null) { - $this->_cat_eid = $row["entity_type_id"]; +// $this->_cat_eid = $row["entity_type_id"]; } } } @@ -91,8 +87,9 @@ public function initCats() public function getCatAttributeInfos($attcode) { $t = $this->tablename("eav_attribute"); - $sql = "SELECT * FROM $t WHERE entity_type_id=? AND attribute_code=?"; - $info = $this->selectAll($sql, array($this->_cat_eid, $attcode)); + $sql = "SELECT * FROM $t WHERE attribute_code=?"; + + $info = $this->selectAll($sql, array($attcode)); return $info[0]; } @@ -165,17 +162,17 @@ public function getCategoryId($parentpath, $cattrs) $path = implode("/", $parentpath); $parentid = array_pop($parentpath); // get child info using parent data - $sql = "SELECT cce.entity_type_id,cce.attribute_set_id,cce.level+1 as level,COALESCE(MAX(eac.position),0)+1 as position - FROM $cet as cce - LEFT JOIN $cet as eac ON eac.parent_id=cce.entity_id - WHERE cce.entity_id=? - GROUP BY eac.parent_id"; + $sql = "SELECT cce.attribute_set_id,cce.level+1 as level,COALESCE(MAX(eac.position),0)+1 as position + FROM $cet as cce + LEFT JOIN $cet as eac ON eac.parent_id=cce.entity_id + WHERE cce.entity_id=? + GROUP BY eac.parent_id"; $info = $this->selectAll($sql, array($parentid)); $info = $info[0]; // insert new category - $sql = "INSERT INTO $cet (entity_type_id,attribute_set_id,parent_id,position,level,path,children_count) VALUES (?,?,?,?,?,?,?)"; + $sql = "INSERT INTO $cet (attribute_set_id,parent_id,position,level,path,children_count) VALUES (?,?,?,?,?,?)"; // insert empty path until we get category id - $data = array($info["entity_type_id"],$info["attribute_set_id"],$parentid,$info["position"],$info["level"],"",0); + $data = array($info["attribute_set_id"],$parentid,$info["position"],$info["level"],"",0); // insert in db,get cat id $catid = $this->insert($sql, $data); @@ -193,8 +190,7 @@ public function getCategoryId($parentpath, $cattrs) foreach ($attinfo as $attrcode => $attdata) { if (isset($attdata["attribute_id"])) { - $inserts[] = "(?,?,?,?,?)"; - $data[] = $info["entity_type_id"]; + $inserts[] = "(?,?,?,?)"; $data[] = $attdata["attribute_id"]; $data[] = 0; // store id 0 for categories $data[] = $catid; @@ -202,7 +198,7 @@ public function getCategoryId($parentpath, $cattrs) } } - $sql = "INSERT INTO $tb (entity_type_id,attribute_id,store_id,entity_id,value) VALUES " . + $sql = "INSERT INTO $tb (attribute_id,store_id,entity_id,value) VALUES " . implode(",", $inserts) . " ON DUPLICATE KEY UPDATE value=VALUES(`value`)"; $this->insert($sql, $data); unset($data); @@ -305,7 +301,7 @@ public function getCategoryIdsFromDef($pcatdef, $srdefs, $item) $catpos[] = "0"; } } else { - $catpos[] = "0"; + $catpos[] = "0"; } $translation_option = array_values(array_filter($a, function ($option) { return stripos($option, '[') === 0; })); $translation_option_part = count($translation_option) ? '::' . $translation_option[0] : ''; @@ -409,18 +405,20 @@ public function updateOrCreateAttributes($category_id, $attributes, $store_id = foreach ($attinfo as $attrcode => $attdata) { if (isset($attdata['attribute_id'])) { - $placeholders[] = '(?,?,?,?,?)'; - $values[] = $this->_cat_eid;//$info['entity_type_id']; + $placeholders[] = '(?,?,?,?)'; //berto - fix query error + //$values[] = $this->_cat_eid;//$info['entity_type_id']; //berto - fix query error $values[] = $attdata['attribute_id']; $values[] = $store_id; $values[] = $category_id; $values[] = $attributes[$attrcode]; } } - - $sql = "INSERT INTO $table (entity_type_id,attribute_id,store_id,entity_id,value) VALUES " . + //berto - fix query error + $sql = "INSERT INTO $table (attribute_id,store_id,entity_id,value) VALUES " . implode(",", $placeholders) . " ON DUPLICATE KEY UPDATE value=VALUES(`value`)"; $this->insert($sql, $values); + + } }