Questions tagged [order-collection]
Questions related to Magento order collections.
34 questions
0 votes
2 answers
29 views
getOrderCollectionFactory with only orders containing specify Attribute Set - Magento2.4
We would like to create our own getOrderCollectionFactory based on Magento\Sales\Order\History, with only orders containing specify Attribute Set. How can we extend the addFieldToFilter part? public ...
2 votes
2 answers
795 views
what this means 'neq' in magento2
can someone explain for me the this attribute used in array? $order = $this->createObject(Order::class) ->getCollection() ->addFieldToFilter('...
0 votes
0 answers
151 views
Magento 2 - Get order collection of current month and placed by new and older customer
I want to get the two order collections by new and older customers for the current month. Please suggest the proper way, I just want the count of orders, Not need all the details of an order. Thanks ...
2 votes
1 answer
479 views
magento 2.3 get order product id without loop
I need the get the items' product id from certain orders. One way to do it is to simply call the items inside the order loop: $orderCollection = $this->orderCollectionFactory->create() ->...
0 votes
0 answers
161 views
Not able to add filters on getItemsCollection in admin order page
I am implementing a feature, where I need to filter the order item list in order admin page. I have checked and found the list is getting from method getItemsCollection(). But when I am trying to ...
0 votes
1 answer
62 views
How to fusion an AND et OR filter/condition in Magento?
how to fusion this instructions: $collection->addFieldToFilter('updated_at', ['from' => $from]) ->addFieldToFilter('updated_at', ['to' => $to]) or $collection->...
0 votes
1 answer
1k views
Get Orders by Store Id
I want to retrieve orders of a specific store? Is there any way to achieve it. R&D just gave me methods to get store id from order or get store/customer information using order. But i have not ...
0 votes
1 answer
1k views
How to filter Order Collection by Specific Product Item name?
I would like to know how to filter order collection by using a product item name in magento 2? $collection = $this->_orderCollectionFactory->create()->addAttributeToSelect('*'); $collection-&...
0 votes
3 answers
1k views
Magento 2: How to get ordered item details from order collection?
I have successfully got the order details and below is my code to get the details. Now, I need to get the ordered item details. Please guide $collection = $this->_orderCollectionFactory->create()...
0 votes
1 answer
441 views
Magento 2 how to get Purchase Point from order collection factory?
I'm trying to get order purchase point (store where it was purchased), I have tried this: $order->getPurchasePoint(); It did not work, any ideas? here is my code public function execute() { ...
1 vote
1 answer
473 views
Magento 2.3 which is the fastest way of retrieving only one item?
I need to get the order id by increment id. I would normally do this by calling the order factory: /* Magento\Sales\Model\OrderFactory */ $order = $this->_orderFactory->loadByIncrementId($...
0 votes
1 answer
165 views
Get order Collection in Observer Class
I am working with an observer where I have to disable a payment method if the user has no existing order, and show it if there is at least one order. I am trying something like this but I am not able ...
0 votes
2 answers
2k views
Magento 2: Filter order collection by payment method
I need to filter order collection based on payment method. I tried the following: $customerOrderCollection = $this->orderCollectionFactory->create()->addFieldToFilter('customer_id', $...
0 votes
1 answer
102 views
Group and count orders by custom delivery date attribute
I have a custom attribute delivery_date set for my orders however I want to create a collection that groups all these dates together and tells me the order count for each date. I have attempted with ...
0 votes
1 answer
368 views
How to use orderCollectionFactory and productCollectionFactory together in Model file?
I have created a custom attribute in product and saved a string in that value and I want if some one order those product of same value string i want that collection of product. So, i want to use \...