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

Option: Only link configurables with simples from the current file. #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -84,6 +84,14 @@ public function autoLink($pid)
$this->dolink($pid, "LIKE CONCAT(cpec.sku,'%')");
}

public function autoLinkCurrentSimples($pid, $skulist=array())
{
if (!empty($skulist))
{
$this->dolink($pid, "LIKE CONCAT(cpec.sku,'%') AND cpes.sku IN (".$this->arr2values($skulist).")", $skulist);
}
}

public function updSimpleVisibility($pid)
{
$vis = $this->getParam("CFGR:updsimplevis", 0);
Expand Down Expand Up @@ -156,6 +164,10 @@ public function getMatchMode($item)
{
$matchmode = "cursimples";
}
elseif ($this->getParam("CFGR:simplesbeforeconf") == 2)
{
$matchmode = "autocursimples";
}
if (isset($item["simples_skus"]) && trim($item["simples_skus"]) != "")
{
$matchmode = "fixed";
Expand All @@ -169,7 +181,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") != 0)
{
$this->_currentsimples[] = $item["sku"];
}
Expand Down Expand Up @@ -334,6 +346,10 @@ public function processItemAfterId(&$item, $params = null)
$this->autoLink($pid);
$this->updSimpleVisibility($pid);
break;
case "autocursimples":
$this->autoLinkCurrentSimples($pid, $this->_currentsimples);
$this->updSimpleVisibility($pid);
break;
case "cursimples":
$this->fixedLink($pid, $this->_currentsimples);
$this->updSimpleVisibility($pid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<option value="1"
<?php if ($this->getParam("CFGR:simplesbeforeconf")==1){?>
selected="selected" <?php }?>>Yes</option>
<option value="2"
<?php if ($this->getParam("CFGR:simplesbeforeconf")==2){?>
selected="selected" <?php }?>>Yes, but filter on SKU</option>
</select></li>
</ul>
<ul class="formline">
Expand Down