Question

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.

Était-ce utile?

La solution

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
    ]
)
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top