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

Change configurable-children linking to avoid mysql limits #305

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
13 changes: 10 additions & 3 deletions Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ public function createConfigurable()
// Update _children column if possible
/** @var Select $childList */
$childList = $connection->select()
->from(['v' => $productModelTable] , ['v.identifier', '_children' => new Expr('GROUP_CONCAT(e.identifier SEPARATOR ",")')])
->from(['v' => $productModelTable] , ['v.identifier', '_children' => new Expr('"1"')])
->joinInner(['e' => $tmpTable],'v.code = ' . 'e.' . $groupColumn, [])
->group('v.identifier');

Expand Down Expand Up @@ -1737,7 +1737,7 @@ public function linkConfigurable()
}

/** @var Select $configurableSelect */
$configurableSelect = $connection->select()->from($tmpTable, ['_entity_id', '_axis', '_children'])->where('_type_id = ?', 'configurable')->where('_axis IS NOT NULL');
$configurableSelect = $connection->select()->from($tmpTable, ['identifier','_entity_id', '_axis', '_children'])->where('_type_id = ?', 'configurable')->where('_axis IS NOT NULL');

/** @var string $pKeyColumn */
$pKeyColumn = '_entity_id';
Expand All @@ -1760,6 +1760,10 @@ public function linkConfigurable()
/** @var array $stores */
$stores = $this->storeHelper->getStores('store_id');

$childrenSelect = $connection->select()
->from($tmpTable, ['identifier'])
->where('parent = :id');

/** @var array $row */
while ($row = $query->fetch()) {
if (!isset($row['_axis'])) {
Expand Down Expand Up @@ -1832,7 +1836,10 @@ public function linkConfigurable()
}

/** @var array $children */
$children = explode(',', $row['_children']);
$children = $connection->fetchCol(
$childrenSelect,
['id' => $row['identifier']]
);
/** @var string $child */
foreach ($children as $child) {
/** @var int $childId */
Expand Down