Magento2 Order Created by Admin or Customer The Next CEO of Stack OverflowHow to add custom customer attribute in custom tab in customer edit page of admin in magento2Magento2: How to add quick order optionMagento2: What is the trigger after order created in AdminGuest checkout, returning customer information from orderOrder from customer or admin?Magento 2: Add custom tab to order details page in customer accountSend email to admin after order cancellation by customer in front end magento2REST API Steps for creating order as created by Magento AdminMagento2: How to stop sending customer welcome email when order created using magento rest api?Add additional Fee on Order page
Purpose of level-shifter with same in and out voltages
Players Circumventing the limitations of Wish
Are the names of these months realistic?
Why am I getting "Static method cannot be referenced from a non static context: String String.valueOf(Object)"?
Defamation due to breach of confidentiality
Which Pokemon have a special animation when running with them out of their pokeball?
Can I calculate next year's exemptions based on this year's refund/amount owed?
Vector calculus integration identity problem
Is it correct to say moon starry nights?
What difference does it make using sed with/without whitespaces?
Computationally populating tables with probability data
Why don't programming languages automatically manage the synchronous/asynchronous problem?
Is it OK to decorate a log book cover?
Physiological effects of huge anime eyes
how one can write a nice vector parser, something that does pgfvecparseA=B-C; D=E x F;
Do I need to write [sic] when including a quotation with a number less than 10 that isn't written out?
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
Spaces in which all closed sets are regular closed
Raspberry pi 3 B with Ubuntu 18.04 server arm64: what chip
Is dried pee considered dirt?
It is correct to match light sources with the same color temperature?
From jafe to El-Guest
What happened in Rome, when the western empire "fell"?
Is there a difference between "Fahrstuhl" and "Aufzug"?
Magento2 Order Created by Admin or Customer
The Next CEO of Stack OverflowHow to add custom customer attribute in custom tab in customer edit page of admin in magento2Magento2: How to add quick order optionMagento2: What is the trigger after order created in AdminGuest checkout, returning customer information from orderOrder from customer or admin?Magento 2: Add custom tab to order details page in customer accountSend email to admin after order cancellation by customer in front end magento2REST API Steps for creating order as created by Magento AdminMagento2: How to stop sending customer welcome email when order created using magento rest api?Add additional Fee on Order page
I want to check whether an order is created by an Admin or by the customer.
magento2 magento-2.1 sales-order magento2.3
add a comment |
I want to check whether an order is created by an Admin or by the customer.
magento2 magento-2.1 sales-order magento2.3
specify your requirement into detail, what you are looking?
– Dhiren Vasoya
Mar 1 at 10:59
add a comment |
I want to check whether an order is created by an Admin or by the customer.
magento2 magento-2.1 sales-order magento2.3
I want to check whether an order is created by an Admin or by the customer.
magento2 magento-2.1 sales-order magento2.3
magento2 magento-2.1 sales-order magento2.3
edited 2 days ago
Rakesh Donga
2,258316
2,258316
asked Mar 1 at 10:57
Avesh NaikAvesh Naik
390112
390112
specify your requirement into detail, what you are looking?
– Dhiren Vasoya
Mar 1 at 10:59
add a comment |
specify your requirement into detail, what you are looking?
– Dhiren Vasoya
Mar 1 at 10:59
specify your requirement into detail, what you are looking?
– Dhiren Vasoya
Mar 1 at 10:59
specify your requirement into detail, what you are looking?
– Dhiren Vasoya
Mar 1 at 10:59
add a comment |
3 Answers
3
active
oldest
votes
By default, Magento2 only stores the remote_ip
in table sales_order
for an order that is place by customer
(while admin order is set to null).
if(!empty($order->getRemoteIp())
//place customer
else
// place by admin
I will try this and let you know if it works.
– Avesh Naik
Mar 1 at 11:08
Thank you for the solution.
– Avesh Naik
Mar 1 at 12:03
my pleasure:)..
– Rakesh Donga
Mar 1 at 12:04
add a comment |
Try this,
<?php
namespace VendorModuleControllerOrders;
class ReadOrders extends MagentoFrameworkAppActionAction
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoSalesApiOrderRepositoryInterface $orderRepo
)
$this->orderRepo = $orderRepo;
parent::__construct($context);
public function execute()
$orderPlaced = '';
$entity_id = '12';
$order = $this->orderRepo->get($entity_id);
$orderPlaced = $order->getRemoteIp();
if ($orderPlaced)
echo "Placed by Customer";
else
echo "Placed by Admin";
Hope this helps :)
add a comment |
You can log this with observers. Just use the sales_order_place_after
event within the etc/adminhtml
directory inside the events.xml
to log that an order has been created by an admin. You can do this for every area.
More about areas Here.
Example of the events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_place_after">
<observer name="My_observer_name" instance="VendorNameSpaceObserverLogOrderAdmin"/>
</event>
</config>
I suggest you create an extra order field via a InstallSchema where you can log this to.
I will try both ans.
– Avesh Naik
Mar 1 at 11:15
add a comment |
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%2f264038%2fmagento2-order-created-by-admin-or-customer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
By default, Magento2 only stores the remote_ip
in table sales_order
for an order that is place by customer
(while admin order is set to null).
if(!empty($order->getRemoteIp())
//place customer
else
// place by admin
I will try this and let you know if it works.
– Avesh Naik
Mar 1 at 11:08
Thank you for the solution.
– Avesh Naik
Mar 1 at 12:03
my pleasure:)..
– Rakesh Donga
Mar 1 at 12:04
add a comment |
By default, Magento2 only stores the remote_ip
in table sales_order
for an order that is place by customer
(while admin order is set to null).
if(!empty($order->getRemoteIp())
//place customer
else
// place by admin
I will try this and let you know if it works.
– Avesh Naik
Mar 1 at 11:08
Thank you for the solution.
– Avesh Naik
Mar 1 at 12:03
my pleasure:)..
– Rakesh Donga
Mar 1 at 12:04
add a comment |
By default, Magento2 only stores the remote_ip
in table sales_order
for an order that is place by customer
(while admin order is set to null).
if(!empty($order->getRemoteIp())
//place customer
else
// place by admin
By default, Magento2 only stores the remote_ip
in table sales_order
for an order that is place by customer
(while admin order is set to null).
if(!empty($order->getRemoteIp())
//place customer
else
// place by admin
edited Mar 27 at 8:28
answered Mar 1 at 11:07
Rakesh DongaRakesh Donga
2,258316
2,258316
I will try this and let you know if it works.
– Avesh Naik
Mar 1 at 11:08
Thank you for the solution.
– Avesh Naik
Mar 1 at 12:03
my pleasure:)..
– Rakesh Donga
Mar 1 at 12:04
add a comment |
I will try this and let you know if it works.
– Avesh Naik
Mar 1 at 11:08
Thank you for the solution.
– Avesh Naik
Mar 1 at 12:03
my pleasure:)..
– Rakesh Donga
Mar 1 at 12:04
I will try this and let you know if it works.
– Avesh Naik
Mar 1 at 11:08
I will try this and let you know if it works.
– Avesh Naik
Mar 1 at 11:08
Thank you for the solution.
– Avesh Naik
Mar 1 at 12:03
Thank you for the solution.
– Avesh Naik
Mar 1 at 12:03
my pleasure:)..
– Rakesh Donga
Mar 1 at 12:04
my pleasure:)..
– Rakesh Donga
Mar 1 at 12:04
add a comment |
Try this,
<?php
namespace VendorModuleControllerOrders;
class ReadOrders extends MagentoFrameworkAppActionAction
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoSalesApiOrderRepositoryInterface $orderRepo
)
$this->orderRepo = $orderRepo;
parent::__construct($context);
public function execute()
$orderPlaced = '';
$entity_id = '12';
$order = $this->orderRepo->get($entity_id);
$orderPlaced = $order->getRemoteIp();
if ($orderPlaced)
echo "Placed by Customer";
else
echo "Placed by Admin";
Hope this helps :)
add a comment |
Try this,
<?php
namespace VendorModuleControllerOrders;
class ReadOrders extends MagentoFrameworkAppActionAction
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoSalesApiOrderRepositoryInterface $orderRepo
)
$this->orderRepo = $orderRepo;
parent::__construct($context);
public function execute()
$orderPlaced = '';
$entity_id = '12';
$order = $this->orderRepo->get($entity_id);
$orderPlaced = $order->getRemoteIp();
if ($orderPlaced)
echo "Placed by Customer";
else
echo "Placed by Admin";
Hope this helps :)
add a comment |
Try this,
<?php
namespace VendorModuleControllerOrders;
class ReadOrders extends MagentoFrameworkAppActionAction
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoSalesApiOrderRepositoryInterface $orderRepo
)
$this->orderRepo = $orderRepo;
parent::__construct($context);
public function execute()
$orderPlaced = '';
$entity_id = '12';
$order = $this->orderRepo->get($entity_id);
$orderPlaced = $order->getRemoteIp();
if ($orderPlaced)
echo "Placed by Customer";
else
echo "Placed by Admin";
Hope this helps :)
Try this,
<?php
namespace VendorModuleControllerOrders;
class ReadOrders extends MagentoFrameworkAppActionAction
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoSalesApiOrderRepositoryInterface $orderRepo
)
$this->orderRepo = $orderRepo;
parent::__construct($context);
public function execute()
$orderPlaced = '';
$entity_id = '12';
$order = $this->orderRepo->get($entity_id);
$orderPlaced = $order->getRemoteIp();
if ($orderPlaced)
echo "Placed by Customer";
else
echo "Placed by Admin";
Hope this helps :)
edited Mar 2 at 3:44
answered Mar 1 at 11:19
Prathap GunasekaranPrathap Gunasekaran
1,5761618
1,5761618
add a comment |
add a comment |
You can log this with observers. Just use the sales_order_place_after
event within the etc/adminhtml
directory inside the events.xml
to log that an order has been created by an admin. You can do this for every area.
More about areas Here.
Example of the events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_place_after">
<observer name="My_observer_name" instance="VendorNameSpaceObserverLogOrderAdmin"/>
</event>
</config>
I suggest you create an extra order field via a InstallSchema where you can log this to.
I will try both ans.
– Avesh Naik
Mar 1 at 11:15
add a comment |
You can log this with observers. Just use the sales_order_place_after
event within the etc/adminhtml
directory inside the events.xml
to log that an order has been created by an admin. You can do this for every area.
More about areas Here.
Example of the events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_place_after">
<observer name="My_observer_name" instance="VendorNameSpaceObserverLogOrderAdmin"/>
</event>
</config>
I suggest you create an extra order field via a InstallSchema where you can log this to.
I will try both ans.
– Avesh Naik
Mar 1 at 11:15
add a comment |
You can log this with observers. Just use the sales_order_place_after
event within the etc/adminhtml
directory inside the events.xml
to log that an order has been created by an admin. You can do this for every area.
More about areas Here.
Example of the events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_place_after">
<observer name="My_observer_name" instance="VendorNameSpaceObserverLogOrderAdmin"/>
</event>
</config>
I suggest you create an extra order field via a InstallSchema where you can log this to.
You can log this with observers. Just use the sales_order_place_after
event within the etc/adminhtml
directory inside the events.xml
to log that an order has been created by an admin. You can do this for every area.
More about areas Here.
Example of the events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_place_after">
<observer name="My_observer_name" instance="VendorNameSpaceObserverLogOrderAdmin"/>
</event>
</config>
I suggest you create an extra order field via a InstallSchema where you can log this to.
answered Mar 1 at 11:09
CompactCodeCompactCode
1,582625
1,582625
I will try both ans.
– Avesh Naik
Mar 1 at 11:15
add a comment |
I will try both ans.
– Avesh Naik
Mar 1 at 11:15
I will try both ans.
– Avesh Naik
Mar 1 at 11:15
I will try both ans.
– Avesh Naik
Mar 1 at 11:15
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%2f264038%2fmagento2-order-created-by-admin-or-customer%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
specify your requirement into detail, what you are looking?
– Dhiren Vasoya
Mar 1 at 10:59