Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Restrict autolink to current file #36

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"];
}
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
</select>
</li>
</ul>
<ul class="formline">
<li class="label" style="width:360px">Only autolink simples from current import.</li>
<li class="value">
<select name="CFGR:restrictskus">
<option value="0" <?php if ($this->getParam("CFGR:restrictskus",0)==0){?>selected="selected"<?php }?>>No</option>
<option value="1" <?php if ($this->getParam("CFGR:restrictskus",0)==1){?>selected="selected"<?php }?>>Yes</option>
</select>
</li>
</ul>
<ul class="formline">
<li class="label" style="width:360px">auto match simples skus before configurable</li>
<li class="value"><select name="CFGR:simplesbeforeconf">
Expand Down