From 8350f0270c844ca804a5acc043f9dd95f30ed4e8 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 12 May 2014 11:42:45 +0200 Subject: [PATCH 1/3] Add option to restrict sku's to current file --- .../magmi_configurableprocessor.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/magmi/plugins/base/itemprocessors/configurables/magmi_configurableprocessor.php b/magmi/plugins/base/itemprocessors/configurables/magmi_configurableprocessor.php index 76bdb02f..964d6a8b 100644 --- a/magmi/plugins/base/itemprocessors/configurables/magmi_configurableprocessor.php +++ b/magmi/plugins/base/itemprocessors/configurables/magmi_configurableprocessor.php @@ -83,9 +83,15 @@ public function dolink($pid,$cond,$conddata=array()) } - public function autoLink($pid) + public function autoLink($pid, $skulist=array()) { - $this->dolink($pid,"LIKE CONCAT(cpec.sku,'%')"); + if($this->getParam("CFGR:restrictskus")==1){ + if(!empty($skulist)){ + $this->dolink($pid,"LIKE CONCAT(cpec.sku,'%') AND cpes.sku IN (".$this->arr2values($skulist).")", $skulist); + } + }else{ + $this->dolink($pid,"LIKE CONCAT(cpec.sku,'%')"); + } } public function updSimpleVisibility($pid) @@ -172,7 +178,7 @@ public function processItemAfterId(&$item,$params=null) //if item is not configurable, nothing to do if($item["type"]!=="configurable") { - if($this->getParam("CFGR:simplesbeforeconf")==1) + if($this->getParam("CFGR:simplesbeforeconf")==1 || $this->getParam("CFGR:restrictskus")==1)) { $this->_currentsimples[]=$item["sku"]; } @@ -319,7 +325,7 @@ public function processItemAfterId(&$item,$params=null) break; case "auto": //destroy old associations - $this->autoLink($pid); + $this->autoLink($pid,$this->_currentsimples); $this->updSimpleVisibility($pid); break; case "cursimples": @@ -360,11 +366,11 @@ public function processColumnList(&$cols,$params=null) public function getPluginParamNames() { - return array("CFGR:simplesbeforeconf","CFGR:updsimplevis","CFGR:nolink"); + return array("CFGR:simplesbeforeconf","CFGR:updsimplevis","CFGR:nolink","CFGR:restrictskus"); } static public function getCategory() { return "Product Type Import"; } -} \ No newline at end of file +} From 74bb372b3d93904057e03ea82559caf02175e580 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 12 May 2014 11:46:02 +0200 Subject: [PATCH 2/3] Add restrictskus option to panel --- .../base/itemprocessors/configurables/options_panel.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/magmi/plugins/base/itemprocessors/configurables/options_panel.php b/magmi/plugins/base/itemprocessors/configurables/options_panel.php index 1c76d01b..2e2748ef 100755 --- a/magmi/plugins/base/itemprocessors/configurables/options_panel.php +++ b/magmi/plugins/base/itemprocessors/configurables/options_panel.php @@ -11,6 +11,15 @@ +