Skip to content

Commit

Permalink
Merge pull request #667 from akeneo/release/104.0.7
Browse files Browse the repository at this point in the history
Release/104.0.7
  • Loading branch information
magentix authored Nov 30, 2023
2 parents 6003d33 + 3cdde6f commit 685bd65
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 85 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,6 @@

### Version 104.0.6 :
* PGTO-393: Replace the sku by the child product UUID in tmp related table

### Version 104.0.7 :
* PGTO-397: Never delete products in a virtual category
17 changes: 16 additions & 1 deletion Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3002,9 +3002,24 @@ public function setCategories(): void
$productIds = implode(',', array_unique(array_column($productCategoryInsertData, 0)));
$productCategoryExclusion = implode(',', $notInWhere);
if (!empty($productIds) && !empty($productCategoryExclusion)) {
$virtualCategories = [];
$visualMerchandiserRuleTable = $connection->getTableName('visual_merchandiser_rule');
if ($connection->isTableExists($visualMerchandiserRuleTable)) {
$virtualCategories = $connection->fetchCol(
$connection->select()
->from($visualMerchandiserRuleTable, ['category_id'])
->where('is_active = ?', 1)
->where('store_id = ?', 0)
);
}
if (empty($virtualCategories)) {
$virtualCategories = [0];
}
$virtualCategories = join(',', $virtualCategories);

$connection->delete(
$categoryProductTable,
new \Zend_Db_Expr("product_id IN ($productIds) AND (product_id, category_id) NOT IN ($productCategoryExclusion)")
new \Zend_Db_Expr("product_id IN ($productIds) AND category_id NOT IN ($virtualCategories) AND (product_id, category_id) NOT IN ($productCategoryExclusion)")
);
}
}
Expand Down
79 changes: 0 additions & 79 deletions Plugin/RebuildDynamicCategories.php

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"nyholm/psr7": "^1.5"
},
"type": "magento2-module",
"version": "104.0.6",
"version": "104.0.7",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
4 changes: 0 additions & 4 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Akeneo\Connector\Api\LogRepositoryInterface" type="Akeneo\Connector\Model\LogRepository"/>

<type name="Akeneo\Connector\Job\Product">
<plugin name="akeneo_job_product_visual_merchandiser_rebuild" type="Akeneo\Connector\Plugin\RebuildDynamicCategories"/>
</type>

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
Expand Down

0 comments on commit 685bd65

Please sign in to comment.