AmpersandHQ / magento2-disable-stock-reservation

This module disables the inventory reservation logic introduced as part of MSI in Magento 2.3.3
GNU Lesser General Public License v3.0
211 stars 60 forks source link

Big number of products in cart is failing an order. #97

Closed Jarzebowsky closed 1 year ago

Jarzebowsky commented 1 year ago

During the big number of products with lot of sources we are not able to place an order correctly. image

The problem seems to be in the table:

<table name="order_sources" resource="default" comment="Order Sources Table">
        <column xsi:type="int" name="extension_id" identity="true" nullable="false" comment="Extension ID"/>
        <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="false" comment="Order ID"/>
        <column xsi:type="text" name="sources" nullable="false" comment="Sources"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="extension_id"/>
        </constraint>
        <constraint xsi:type="foreign"
                    referenceId="ORDER_SOURCES_ORDER_ID_SALES_ORDER_ITEM_ORDER_ID"
                    table="order_sources"
                    column="order_id" referenceTable="sales_order" referenceColumn="entity_id"
                    onDelete="CASCADE"/>
    </table>

We prepared and tested a fix for it.

--- a/vendor/ampersand/magento2-disable-stock-reservation/src/etc/db_schema.xml
+++ b/vendor/ampersand/magento2-disable-stock-reservation/src/etc/db_schema.xml (date 1673362460703)
@@ -4,7 +4,7 @@
     <table name="order_sources" resource="default" comment="Order Sources Table">
         <column xsi:type="int" name="extension_id" identity="true" nullable="false" comment="Extension ID"/>
         <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="false" comment="Order ID"/>
-        <column xsi:type="text" name="sources" nullable="false" comment="Sources"/>
+        <column xsi:type="mediumtext" name="sources" nullable="false" comment="Sources"/>
         <constraint xsi:type="primary" referenceId="PRIMARY">
             <column name="extension_id"/>
         </constraint>

If that's needed I can prepare a PR with those changes as well.

convenient commented 1 year ago

Oh good catch @Jarzebowsky please raise a PR

Just curious, how many products counts as "big" ?

Jarzebowsky commented 1 year ago

30+ but each can have even 100 sources :)

Can you tell me from which branch I should raise a PR? master?

convenient commented 1 year ago

@Jarzebowsky master please. Thanks for the issue :)

Jarzebowsky commented 1 year ago

@convenient I'm missing permission to push the remote branch to the repository to create a PR. Can you help me out with that?

Jarzebowsky commented 1 year ago

Nvm :) Long time didn't use the GitHub. Should be ready to be merged 👍

convenient commented 1 year ago

@Jarzebowsky in github you usually create a fork, make changes in your fork, then raise a pull request to the ampersandhq remote

May be worthwhile having a read over https://docs.github.com/en/get-started/quickstart/contributing-to-projects if you're interested, as that approach will allow you to contribute to many more projects in github in general.

If you do not want to invest that much time learning the github forking methodology don't worry and I can sort this out myself next week :)

edit: missed your second comment, you cracked it 👍