Questions tagged [order-collection]

Questions related to Magento order collections.

Filter by
Sorted by
Tagged with
0 votes
0 answers
43 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 ...
user avatar
1 vote
1 answer
108 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() ->...
user avatar
  • 143
0 votes
0 answers
55 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 ...
user avatar
0 votes
1 answer
27 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->...
user avatar
0 votes
1 answer
307 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 ...
user avatar
0 votes
1 answer
247 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-&...
user avatar
  • 583
0 votes
3 answers
233 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()...
user avatar
  • 480
0 votes
1 answer
156 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() { ...
user avatar
1 vote
1 answer
51 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($...
user avatar
  • 143
0 votes
1 answer
46 views

Get order Collection in Observer Class

I am working with an observer where i have to disable a payment method if user has no order existed and show it if at least one order existed. I am trying something like this but not able to get the ...
user avatar
0 votes
2 answers
771 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', $...
user avatar
  • 550
0 votes
1 answer
18 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 ...
user avatar
  • 5,245
0 votes
1 answer
87 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 \...
user avatar
  • 566
0 votes
2 answers
346 views

How to add payment filter in Order collection factory magento 2.3

I need to add the "po_number" as filter in order collection factory, i am trying to implement this in the sales order history page using getOrders function in the History.php Full Code : <...
user avatar
  • 308
0 votes
3 answers
640 views

Magento2: I need to get order Purchase Order Date and Purchased From fields in observer

I need to get order Purchase Order Date and Purchased From fields in the observer. Here is my code: namespace Abc\Mkt\Observer; use Magento\Framework\Event\Observer; use Magento\Framework\Event\...
user avatar
  • 1,023
0 votes
3 answers
606 views

Magento1 Get Item Details From Order Collection

in Magento 1.9 I am working on order collection I am getting order collection successfully using the below code now I want to get item details from order how I can get this.I am using this collection $...
user avatar
  • 379
3 votes
2 answers
1k views

Magento 2.3.0 How to add store filter in searchCriteriaBuilder

In my custom module, I am trying to add store filter in orderRepository using searchCriteriaBuilder but it is throwing an error like below. 1 exception(s): Exception #0 (Exception): Warning: PDO::...
user avatar
  • 5,876
0 votes
2 answers
227 views

How to get the items orders by the customer in the order collection?

I need to get the collection of orders with the the items ordered by using the customer ID. But I am not getting the items ordered in my collection. Please help. $objectManager = \Magento\Framework\...
user avatar
1 vote
1 answer
425 views

Magento 2.3.0 How to get product image from order item collection

I would like to get a product image from order items collection. How can I get a product thumbnail image? Below is my custom order item collection code : public function getEmailLogOrders() { $...
user avatar
  • 5,876
1 vote
3 answers
1k views

Get collection of orders excluding cancelled order in Magento 2

I have got order collection with the following code: $orders = $objectManager->create('Magento\Sales\Model\Order')->getCollection(); Which is working fine. Problem is that it returns all types ...
user avatar
1 vote
3 answers
1k views

Get billing address line 1 and line 2 in order collection: Magento 2

I am trying to get billing address line 1 and line 2 with city and state in order collection. Here is my code: $oid = 1; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order =...
user avatar
5 votes
3 answers
18k views

Get order collection by order id in Magento 2?

I am trying to get order collection by order id in Magento 2. Here is my code: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $orders = $objectManager->create('Magento\...
user avatar
0 votes
0 answers
47 views

Data Not Set in admin Grid in magento2

I am Filter the Order Collection. Code give as protected function searchResultToOutput(SearchResultInterface $searchResult) { $arrItems = []; $arrItems['items'] = []; foreach ($...
user avatar
  • 1,515
1 vote
2 answers
2k views

How to get order collection filter with customer_is_guest and email (Magento 2)

How to get order id from collection with filter customer_is_guest = 1 and customer email $order_collection = $objectManager->create('Magento\Sales\Model\Order')->getCollection()->...
user avatar
  • 799
0 votes
1 answer
813 views

Magento 2 : How to get order collection group by customer?

To get order collection by customer wise i.e.., customer A and customer B have placed order and it should retrieve by customer wise per collection? public function getOrdersByCustomer() { $...
user avatar
0 votes
2 answers
1k views

Filter sales/order collection according to country

I would like to filter out my home country (GB or United Kingdom) from the following sales/order collection. How can this be done? $orders = Mage::getModel('sales/order')->getCollection() ...
user avatar
  • 332
2 votes
0 answers
134 views

{M1) Product collection sort order by views for Most Viewed Products

Does anyone know how to order by views (ascending/descending) a product collection when working with most viewed products? I am using this following code: $_productCollection = Mage::...
user avatar
  • 597
2 votes
2 answers
1k views

Magento 2 - Get orders that were completed x days ago

I'm trying to get all orders that were completed a certain number of days ago using the below code: protected $searchCriteria; public function __construct( \Magento\Framework\App\Action\Context ...
user avatar
  • 5,245
2 votes
1 answer
107 views

Order collection not showing the order that have been invoiced

I try to retrieve all the order collections, but when I observe by looping the collections and print the order id, I notice the order that has been invoiced is not inside the collection. $collections ...
user avatar
0 votes
3 answers
2k views

Orders collection - how to get all in the time range (current day)

Trying to gather all the orders (current day) and sum totals Updated: $format = Mage::getModel('core/date')->date('Y/m/d'); $from = $format.' 00:00:00'; $now = Mage::getModel('core/...
user avatar
  • 867
2 votes
1 answer
915 views

PayPal Automatically Update Payment Review Orders

If a customer pays via PayPal and his account is not covered, the order in Magento is in the state "payment_review". You can then: Accept the payment manually. Deny the payment. Get a payment update. ...
user avatar
  • 5,580
5 votes
5 answers
6k views

Column 'store_id' in where clause is ambiguous when adding custom order attribute to grid and changing store

I have created a custom order attribute and I am now able to show it in the sales order grid; my previous question: Adding custom sales order attribute to order grid If I were to change the drop down ...
user avatar
  • 1,018