Get order item collection from payment magento 2How to get order from customer Magento 2?Magento 2: Get quantity item from the orderMagento 2 Access shipping code from Payment MouleMagento 2: unable to set payment Transaction Id after successful payment processing (solved by myself)Magento 2 get and set Qty of product with observerGet Quote from Order Success ObserverHow to get admin order items from admin order quoteMagento 2, How to get Payment infoInterface from order?Magento2 : On update of quote item price i am not able to get payment method on payment stepGet new field address in the payment module (capture function). M2.2.4
What makes Ada the language of choice for the ISS's safety-critical systems?
Why did the Herschel Space Telescope need helium coolant?
Second (easy access) account in case my bank screws up
Confusion around using "des" in sentences
What is the highest possible permanent AC at character creation?
Grover algorithm for a database search: where is the quantum advantage?
Difference between > and >> when used with a named pipe
Is using haveibeenpwned to validate password strength rational?
1980s live-action movie where individually-coloured nations on clouds fight
bash script: "*.jpg" expansion not working as expected inside $(...), for picking a random file
What to do when surprise and a high initiative roll conflict with the narrative?
Fixing obscure 8080 emulator bug?
What makes an item an artifact?
Do simulator games use a realistic trajectory to get into orbit?
This riddle is not to see but to solve
Would the US government be able to hold control if all electronics were disabled for an indefinite amount of time?
How to handle self harm scars on the arm in work environment?
How is water heavier than petrol, even though its molecular weight is less than petrol?
Are there downsides to using std::string as a buffer?
How to hide an urban landmark?
Déjà vu, again?
Using "subway" as name for London Underground?
What is wrong with this proof that symmetric matrices commute?
Find the limit of a multiplying term function when n tends to infinity.
Get order item collection from payment magento 2
How to get order from customer Magento 2?Magento 2: Get quantity item from the orderMagento 2 Access shipping code from Payment MouleMagento 2: unable to set payment Transaction Id after successful payment processing (solved by myself)Magento 2 get and set Qty of product with observerGet Quote from Order Success ObserverHow to get admin order items from admin order quoteMagento 2, How to get Payment infoInterface from order?Magento2 : On update of quote item price i am not able to get payment method on payment stepGet new field address in the payment module (capture function). M2.2.4
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How to get itemCollection from Payment ?
I get getOrder() on null for the below code
$payment = $observer->getEvent()->getPayment();
$items = $payment->getOrder()->getItemsCollection();
magento2
add a comment |
How to get itemCollection from Payment ?
I get getOrder() on null for the below code
$payment = $observer->getEvent()->getPayment();
$items = $payment->getOrder()->getItemsCollection();
magento2
Where you try to get order information?
– Sohel Rana
Jul 27 '16 at 8:16
When order is completed during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 8:54
can you please share full information in question or event details?
– Abdul
Dec 5 '17 at 12:44
add a comment |
How to get itemCollection from Payment ?
I get getOrder() on null for the below code
$payment = $observer->getEvent()->getPayment();
$items = $payment->getOrder()->getItemsCollection();
magento2
How to get itemCollection from Payment ?
I get getOrder() on null for the below code
$payment = $observer->getEvent()->getPayment();
$items = $payment->getOrder()->getItemsCollection();
magento2
magento2
asked Jul 27 '16 at 8:02
SushivamSushivam
1,25921849
1,25921849
Where you try to get order information?
– Sohel Rana
Jul 27 '16 at 8:16
When order is completed during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 8:54
can you please share full information in question or event details?
– Abdul
Dec 5 '17 at 12:44
add a comment |
Where you try to get order information?
– Sohel Rana
Jul 27 '16 at 8:16
When order is completed during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 8:54
can you please share full information in question or event details?
– Abdul
Dec 5 '17 at 12:44
Where you try to get order information?
– Sohel Rana
Jul 27 '16 at 8:16
Where you try to get order information?
– Sohel Rana
Jul 27 '16 at 8:16
When order is completed during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 8:54
When order is completed during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 8:54
can you please share full information in question or event details?
– Abdul
Dec 5 '17 at 12:44
can you please share full information in question or event details?
– Abdul
Dec 5 '17 at 12:44
add a comment |
2 Answers
2
active
oldest
votes
you can get first order id after getting order id load product,
$orderid = $payment->getOrder()->getId()
$orderItems = $order->getAllItems();
public function __construct(
..
MagentoSalesModelOrder $order,
...
)
$this->order = $order;
public function getOrderItems()
$order=$this->order->load($orderId);
return $orderItems = $order->getAllItems();
Rakesh, could you please tell how to do the above in this magento.stackexchange.com/questions/127636/… in my VendorModuleModelEngine.php, cause im trying the above code during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 9:00
have you check your order id is getting or not? if order id is getting then you can do above way
– Rakesh Jesadiya
Jul 27 '16 at 9:06
No im not getting, the moment i m trying to update a product in backend, i get Call to a member function getOrder() on null in C:xampphtdocsmagento2x_3appcodeVendorModuleModelEngine.php on line 158
– Sushivam
Jul 27 '16 at 9:11
Any update @Rakesh
– Sushivam
Jul 27 '16 at 9:22
no idea for that
– Rakesh Jesadiya
Jul 27 '16 at 9:45
add a comment |
Try following way:
$payment = $observer->getPayment();
$order = $payment->getOrder();
$items = $order->getAllVisibleItems();
foreach ($items as $item)
error_log($item->getProductId());
error_log($item->getSku());
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f127644%2fget-order-item-collection-from-payment-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
you can get first order id after getting order id load product,
$orderid = $payment->getOrder()->getId()
$orderItems = $order->getAllItems();
public function __construct(
..
MagentoSalesModelOrder $order,
...
)
$this->order = $order;
public function getOrderItems()
$order=$this->order->load($orderId);
return $orderItems = $order->getAllItems();
Rakesh, could you please tell how to do the above in this magento.stackexchange.com/questions/127636/… in my VendorModuleModelEngine.php, cause im trying the above code during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 9:00
have you check your order id is getting or not? if order id is getting then you can do above way
– Rakesh Jesadiya
Jul 27 '16 at 9:06
No im not getting, the moment i m trying to update a product in backend, i get Call to a member function getOrder() on null in C:xampphtdocsmagento2x_3appcodeVendorModuleModelEngine.php on line 158
– Sushivam
Jul 27 '16 at 9:11
Any update @Rakesh
– Sushivam
Jul 27 '16 at 9:22
no idea for that
– Rakesh Jesadiya
Jul 27 '16 at 9:45
add a comment |
you can get first order id after getting order id load product,
$orderid = $payment->getOrder()->getId()
$orderItems = $order->getAllItems();
public function __construct(
..
MagentoSalesModelOrder $order,
...
)
$this->order = $order;
public function getOrderItems()
$order=$this->order->load($orderId);
return $orderItems = $order->getAllItems();
Rakesh, could you please tell how to do the above in this magento.stackexchange.com/questions/127636/… in my VendorModuleModelEngine.php, cause im trying the above code during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 9:00
have you check your order id is getting or not? if order id is getting then you can do above way
– Rakesh Jesadiya
Jul 27 '16 at 9:06
No im not getting, the moment i m trying to update a product in backend, i get Call to a member function getOrder() on null in C:xampphtdocsmagento2x_3appcodeVendorModuleModelEngine.php on line 158
– Sushivam
Jul 27 '16 at 9:11
Any update @Rakesh
– Sushivam
Jul 27 '16 at 9:22
no idea for that
– Rakesh Jesadiya
Jul 27 '16 at 9:45
add a comment |
you can get first order id after getting order id load product,
$orderid = $payment->getOrder()->getId()
$orderItems = $order->getAllItems();
public function __construct(
..
MagentoSalesModelOrder $order,
...
)
$this->order = $order;
public function getOrderItems()
$order=$this->order->load($orderId);
return $orderItems = $order->getAllItems();
you can get first order id after getting order id load product,
$orderid = $payment->getOrder()->getId()
$orderItems = $order->getAllItems();
public function __construct(
..
MagentoSalesModelOrder $order,
...
)
$this->order = $order;
public function getOrderItems()
$order=$this->order->load($orderId);
return $orderItems = $order->getAllItems();
answered Jul 27 '16 at 8:57
Rakesh JesadiyaRakesh Jesadiya
30.6k1578130
30.6k1578130
Rakesh, could you please tell how to do the above in this magento.stackexchange.com/questions/127636/… in my VendorModuleModelEngine.php, cause im trying the above code during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 9:00
have you check your order id is getting or not? if order id is getting then you can do above way
– Rakesh Jesadiya
Jul 27 '16 at 9:06
No im not getting, the moment i m trying to update a product in backend, i get Call to a member function getOrder() on null in C:xampphtdocsmagento2x_3appcodeVendorModuleModelEngine.php on line 158
– Sushivam
Jul 27 '16 at 9:11
Any update @Rakesh
– Sushivam
Jul 27 '16 at 9:22
no idea for that
– Rakesh Jesadiya
Jul 27 '16 at 9:45
add a comment |
Rakesh, could you please tell how to do the above in this magento.stackexchange.com/questions/127636/… in my VendorModuleModelEngine.php, cause im trying the above code during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 9:00
have you check your order id is getting or not? if order id is getting then you can do above way
– Rakesh Jesadiya
Jul 27 '16 at 9:06
No im not getting, the moment i m trying to update a product in backend, i get Call to a member function getOrder() on null in C:xampphtdocsmagento2x_3appcodeVendorModuleModelEngine.php on line 158
– Sushivam
Jul 27 '16 at 9:11
Any update @Rakesh
– Sushivam
Jul 27 '16 at 9:22
no idea for that
– Rakesh Jesadiya
Jul 27 '16 at 9:45
Rakesh, could you please tell how to do the above in this magento.stackexchange.com/questions/127636/… in my VendorModuleModelEngine.php, cause im trying the above code during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 9:00
Rakesh, could you please tell how to do the above in this magento.stackexchange.com/questions/127636/… in my VendorModuleModelEngine.php, cause im trying the above code during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 9:00
have you check your order id is getting or not? if order id is getting then you can do above way
– Rakesh Jesadiya
Jul 27 '16 at 9:06
have you check your order id is getting or not? if order id is getting then you can do above way
– Rakesh Jesadiya
Jul 27 '16 at 9:06
No im not getting, the moment i m trying to update a product in backend, i get Call to a member function getOrder() on null in C:xampphtdocsmagento2x_3appcodeVendorModuleModelEngine.php on line 158
– Sushivam
Jul 27 '16 at 9:11
No im not getting, the moment i m trying to update a product in backend, i get Call to a member function getOrder() on null in C:xampphtdocsmagento2x_3appcodeVendorModuleModelEngine.php on line 158
– Sushivam
Jul 27 '16 at 9:11
Any update @Rakesh
– Sushivam
Jul 27 '16 at 9:22
Any update @Rakesh
– Sushivam
Jul 27 '16 at 9:22
no idea for that
– Rakesh Jesadiya
Jul 27 '16 at 9:45
no idea for that
– Rakesh Jesadiya
Jul 27 '16 at 9:45
add a comment |
Try following way:
$payment = $observer->getPayment();
$order = $payment->getOrder();
$items = $order->getAllVisibleItems();
foreach ($items as $item)
error_log($item->getProductId());
error_log($item->getSku());
add a comment |
Try following way:
$payment = $observer->getPayment();
$order = $payment->getOrder();
$items = $order->getAllVisibleItems();
foreach ($items as $item)
error_log($item->getProductId());
error_log($item->getSku());
add a comment |
Try following way:
$payment = $observer->getPayment();
$order = $payment->getOrder();
$items = $order->getAllVisibleItems();
foreach ($items as $item)
error_log($item->getProductId());
error_log($item->getSku());
Try following way:
$payment = $observer->getPayment();
$order = $payment->getOrder();
$items = $order->getAllVisibleItems();
foreach ($items as $item)
error_log($item->getProductId());
error_log($item->getSku());
answered Jul 27 '16 at 10:05
Sohel RanaSohel Rana
24.3k34664
24.3k34664
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f127644%2fget-order-item-collection-from-payment-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where you try to get order information?
– Sohel Rana
Jul 27 '16 at 8:16
When order is completed during the sales_order_payment_place_end event
– Sushivam
Jul 27 '16 at 8:54
can you please share full information in question or event details?
– Abdul
Dec 5 '17 at 12:44