Skip to content

Commerce Product Revenue SQL Error #348

@outline4

Description

@outline4

Description

Hi, I've just purchased and installed sprout data studio.

All I wanted to achieve is to create a commerce product revenue report of the current month.

Clicking on view report generates an error.

How to reproduce

This is the error message when I want to view the commerce product revenue report:

Database Exception – yii\db\Exception
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lineitems.saleAmount' in 'SELECT'
The SQL being executed was: SELECT variants.id AS variantId, products.id AS productId, SUM(lineitems.total) AS total, SUM(lineitems.saleAmount) AS saleAmount, SUM(lineitems.salePrice * lineitems.qty) AS productRevenue, SUM(lineitems.qty) AS quantitySold, variants.sku AS SKU
FROM craft_commerce_orders orders
LEFT JOIN craft_commerce_lineitems lineitems ON orders.id = lineitems.orderId
LEFT JOIN craft_commerce_variants variants ON lineitems.purchasableId = variants.id
LEFT JOIN craft_commerce_products products ON variants.productId = products.id
LEFT JOIN craft_elements elements ON orders.id = elements.id
WHERE (elements.dateDeleted IS NULL) AND (orders.dateOrdered >= '2025-02-28 23:00:00') AND (orders.dateOrdered <= '2025-03-30 22:00:00')
GROUP BY variantId
ORDER BY products.id DESC
Error Info: Array
(
[0] => 42S22
[1] => 1054
[2] => Unknown column 'lineitems.saleAmount' in 'SELECT'
)

Caused by: PDOException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lineitems.saleAmount' in 'SELECT'

Commerce Version: 5.3.8 PRO

Sprout Version

5.0.3

Craft Version

5.6.17 PRO

Database Type Version

MySql

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions