Uploaded image for project: 'In-Commerce'
  1. In-Commerce
  2. MINC-116

Do a full QtyReserved and QtyBackordered recalculation in products

    Details

    • Type: Bug Report
    • Status: New
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Data Management
    • Labels:
      None

      Description

      Create recalculateInventory(array $product_ids) method, that will:

      • get all records from OrderItems table, where given products are being used
      • calculate Products.QtyReserved column as SUM(OrderItems.QuantityReserved)
      • calculate Products.QtyBackordered column as SUM(IF(OrderItems.BackorderFlag = 1, OrderItems.QuantityReserved - OrderItems.Quantity, 0))
      • in all places, where we manipulate with QtyInStock, QtyReserved, QtyBackOrdered columns of product/product order combination we need to use this new method instead

      Same applies to product option combinations table.

      This cover index would be very helpful to speed up SQL:
      ALTER TABLE OrderItems ADD INDEX IX_PRODUCT_INVENTORY_COVER (ProductId, QuantityReserved, BackOrderFlag, Quantity);

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                alex Alex
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: