Child pages
  • [in-commerce] SQL error when splitting order with tangible products [5.2.0-B1]
Skip to end of metadata
Go to start of metadata

In  MINC-79 - Getting issue details... STATUS  (4 years ago) there were some code changes made to create the "Modern Store" theme. Unfortunately we haven't tested the case, when not all products in order were in stock and order is splitted into several ones. This case now produces SQL error:

RuntimeException: Unknown column 'oi.BackOrderFlag' in 'field list' (1054)
SQL:
    SELECT oi.BackOrderFlag AS BackOrderFlagCalc, PackageNum, ProductName, ShippingTypeId, CONCAT(52x_Products.Type, "_", IF (52x_Products.Type NOT IN (4,1), CONCAT(OrderItemId, "_", 52x_Products.ProductId), ""), "_", PackageNum ) AS Grouping, SUM(Quantity) AS TotalItems, SUM(52x_OrderItems.Weight*Quantity) AS TotalWeight, SUM(Price * Quantity) AS TotalAmount, SUM(QuantityReserved) AS TotalReserved, 52x_Products.Type AS ProductType
    FROM 52x_OrderItems
    LEFT JOIN 52x_Products ON 52x_Products.ProductId = 52x_OrderItems.ProductId
    WHERE OrderId = 34
    GROUP BY BackOrderFlagCalc, Grouping
    ORDER BY BackOrderFlagCalc ASC, PackageNum ASC, ProductType ASC  in ...\core\kernel\utility\logger.php on line 878

Solution

Use OrderItems table alias used in each SQL (the BackOrderFlag column is used in 2 SQLs) to avoid SQL error.

Related Tasks

MINC-128 - Getting issue details... STATUS