0

the default Magento2 report from ordered products excludes orders with status canceled. I also want to exclude status closed.

/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php

in line 60 shows

  $connection->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED),

How can I add STATE_CLOSED here? I tried a bit but no success.

1 Answer 1

2

your condition should be in your case

$connection->quoteInto(
    "{$orderTableAliasName}.state NOT IN (?)", 
    [
        \Magento\Sales\Model\Order::STATE_CANCELED, 
        \Magento\Sales\Model\Order::STATE_CLOSED
    ]
)
2
  • Thank you, its working! Commented Mar 12, 2021 at 7:49
  • you are most welcome! :)
    – Diana
    Commented Mar 12, 2021 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.