Questions tagged [order-collection]
Questions related to Magento order collections.
34
questions
0
votes
0
answers
42
views
Check if database address value is empty in $collection?
How can I check if the field "company" contains a value or not, and set another value ("not a company" for instance) if empty?
class OrdersGrid
{
public function afterGetReport($...
2
votes
2
answers
265
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
101
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
318
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
122
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
36
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
808
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
859
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
947
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
350
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
101
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
140
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
58
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
251
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
\...
0
votes
2
answers
556
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 :
<...
0
votes
3
answers
1k
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\...
0
votes
3
answers
959
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
$...
3
votes
2
answers
2k
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::...
0
votes
2
answers
532
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\...
1
vote
1
answer
967
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() {
$...
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 ...
1
vote
3
answers
2k
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 =...
5
votes
3
answers
22k
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\...
0
votes
0
answers
51
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 ($...
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()->...
0
votes
1
answer
957
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() {
$...
0
votes
2
answers
2k
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() ...
2
votes
0
answers
148
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::...
2
votes
2
answers
2k
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 ...
2
votes
1
answer
116
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 ...
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/...
2
votes
1
answer
966
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.
...
5
votes
5
answers
7k
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 ...