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

Move MSI support to separate module / package #3416

Open
jean-bernard-valentaten opened this issue Oct 21, 2024 · 3 comments
Open

Move MSI support to separate module / package #3416

jean-bernard-valentaten opened this issue Oct 21, 2024 · 3 comments
Labels

Comments

@jean-bernard-valentaten

Is your feature request related to a problem? Please describe.

A lot of Magento shops do not require the use of MSI (multi stock inventory) and could thus speed up the installation / deployment processes, reduce the overall disk consumption and improve performance by removing the whole MSI feature (roughly 78 packages).

Yireo provides a neat meta-package that helps removing MSI via the replace feature of composer, as can be seen here: https://github.com/yireo/magento2-replace-inventory

Unfortunately this does not work well in combination with the Smile Elasticsuite, since the latter requires the following MSI packages in its root composer.json:

  • magento/module-inventory-sales-api
  • magento/module-inventory-sales
  • magento/module-inventory-indexer

These packages in turn have dependencies to other MSI packages, making it extremely hard to replace MSI when a shop does not actually need it. And since not all MSI packages can be removed the benefit is not as big as it could be.

Describe the solution you'd like

I'd suggest to move MSI support to a Smile package of its own. Said package can then be replaced in case MSI is not being used and thus the whole MSI overhead can be removed from shops. Also Yireo could be notified of the existance of said package and add it to the meta-package mentioned above, making it fully compatible to a rather usual setup (Magento + Smile Elasticsuite - MSI).

Describe alternatives you've considered

None

Additional context

The following packages make use of MSI classes / interfaces:

  • smile/module-elasticsuite-catalog
  • smile/module-elasticsuite-catalog-rule
@danielraab
Copy link

I am looking forward for this feature too.

@romainruaud
Copy link
Collaborator

Hi guys,

we might consider doing this in a near future or to provide at least a way to have a more loose coupling on MSI.

We integrated this in the core due to the official statement of Adobe back in time which was : "MSI will replace the legacy CatalogInventory in an upcoming release". So we decided to anticipate this and 5 years later, CatalogInventory is still there and the entire Magento community is removing MSI when building a project :)

@rikwillems
Copy link

I'm using this patch to remove MSI from Elasticsuite. Not the nicest way but it works.

--- src/module-elasticsuite-catalog/etc/di.xml
+++ src/module-elasticsuite-catalog/etc/di.xml
@@ -276,7 +276,7 @@
     </type>

     <preference for="Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\InventoryDataInterface"
-                type="Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\InventoryData" />
+                type="Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\Deprecation\InventoryData" />

     <virtualType name="Smile\ElasticsuiteCatalog\Search\Request\Product\Coverage\Builder"
         type="\Smile\ElasticsuiteCore\Search\Request\Builder">

--- src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php
+++ src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php
@@ -57,16 +57,7 @@
      * @param StockIndexTableNameResolverInterface $stockIndexTableProvider Stock index table provider.
      */
     public function __construct(
-        ResourceConnection $resource,
-        StoreManagerInterface $storeManager,
-        MetadataPool $metadataPool,
-        StockResolverInterface $stockResolver,
-        StockIndexTableNameResolverInterface $stockIndexTableProvider
     ) {
-        $this->stockResolver = $stockResolver;
-        $this->stockIndexTableProvider = $stockIndexTableProvider;
-
-        parent::__construct($resource, $storeManager, $metadataPool);
     }

     /**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants