How to identify to customer is existing or not in magento 1.9?Programmatically create new orders from multiple existing ordersCreate invoice and shipment in magento via cron based on store view and order ageAdd products to order programmatically and have payment module see themExclude a specific categoryHow to create a module Email Delivery to Customer if the stock of existing and empty stockInject element to left, right, before/after content, … without layout changes in m1SOLVED Magento 1.9 cannot place order “Some transactions have not been committed or rolled back”Magento | How to add Save Action for Customer Group new fieldAfter Migration from Magento 1.9.1.0 to Magento 2.2.4, Customer Creation IssueMagento 1.9.2.4 cURL issue
Convert GE Load Center to main breaker
How (un)safe is it to ride barefoot?
Why would a home insurer offer a discount based on credit score?
Was self-modifying code possible using BASIC?
How can I find out about the game world without meta-influencing it?
How to create two-week recurring alarms and reminders?
Should I explain the reasons for gaslighting?
What does the homotopy coherent nerve do to spaces of enriched functors?
Is all-caps blackletter no longer taboo?
Mathematica 12 has gotten worse at solving simple equations?
Part of my house is inexplicably gone
What is the STRONGEST end-of-line knot to use if you want to use a steel-thimble at the end, so that you've got a steel-eyelet at the end of the line?
How to make a composition of functions prettier?
What's the difference between DHCP and NAT? Are they mutually exclusive?
How can I list the different hex characters between two files?
Why vspace-lineskip removes space after tikz picture although it stands before the picture?
Does a single fopen introduce TOCTOU vulnerability?
How many sets of dice do I need for D&D?
Do Veracrypt encrypted volumes have any kind of brute force protection?
Placement of positioning lights on A320 winglets
When to use и or а as “and”?
Is it true that "only photographers care about noise"?
My mom's return ticket is 3 days after I-94 expires
In American Politics, why is the Justice Department under the President?
How to identify to customer is existing or not in magento 1.9?
Programmatically create new orders from multiple existing ordersCreate invoice and shipment in magento via cron based on store view and order ageAdd products to order programmatically and have payment module see themExclude a specific categoryHow to create a module Email Delivery to Customer if the stock of existing and empty stockInject element to left, right, before/after content, … without layout changes in m1SOLVED Magento 1.9 cannot place order “Some transactions have not been committed or rolled back”Magento | How to add Save Action for Customer Group new fieldAfter Migration from Magento 1.9.1.0 to Magento 2.2.4, Customer Creation IssueMagento 1.9.2.4 cURL issue
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
When we create an order with the new customer from the backend through then how to detect the programmatically user is existing or not?
I am triggering this event "sales_order_place_after" and I have tried with below code but submit order then we will get the error: the customer is exist
$customer = Mage::getModel('customer/customer');
if ($websiteId)
$customer->setWebsiteId($websiteId);
$customer->loadByEmail($email);
if ($customer->getId())
return true;
return false;
magento-1.9
add a comment |
When we create an order with the new customer from the backend through then how to detect the programmatically user is existing or not?
I am triggering this event "sales_order_place_after" and I have tried with below code but submit order then we will get the error: the customer is exist
$customer = Mage::getModel('customer/customer');
if ($websiteId)
$customer->setWebsiteId($websiteId);
$customer->loadByEmail($email);
if ($customer->getId())
return true;
return false;
magento-1.9
add a comment |
When we create an order with the new customer from the backend through then how to detect the programmatically user is existing or not?
I am triggering this event "sales_order_place_after" and I have tried with below code but submit order then we will get the error: the customer is exist
$customer = Mage::getModel('customer/customer');
if ($websiteId)
$customer->setWebsiteId($websiteId);
$customer->loadByEmail($email);
if ($customer->getId())
return true;
return false;
magento-1.9
When we create an order with the new customer from the backend through then how to detect the programmatically user is existing or not?
I am triggering this event "sales_order_place_after" and I have tried with below code but submit order then we will get the error: the customer is exist
$customer = Mage::getModel('customer/customer');
if ($websiteId)
$customer->setWebsiteId($websiteId);
$customer->loadByEmail($email);
if ($customer->getId())
return true;
return false;
magento-1.9
magento-1.9
edited Jun 5 at 12:02
Ankit Dholiya
asked Jun 5 at 11:31
Ankit DholiyaAnkit Dholiya
64
64
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You want the checkout_success event
<events>
<checkout_onepage_controller_success_action>
<observers>
<abandonedcart_observer>
<type>singleton</type>
<class>whatever/observer</class>
<method>doStuff</method>
</abandonedcart_observer>
</observers>
</checkout_onepage_controller_success_action>
</events>
public function doStuff(Varien_Event_Observer $observer)
$orderIds = $observer->getEvent()->getOrderIds();
$collection = Mage::getResourceModel('sales/order_collection')
->addFieldToFilter('entity_id', array('in' => $orderIds));
foreach ($collection as $order)
// do stuff
To demonstrate what you could do you can put some test logic on success phtml to understand more about what's happening and how to tell difference between customers
app/design/frontend/[package]/[theme]/template/checkout/success.phtml
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$quoteId = $order->getQuoteId();
$quote = Mage::getModel('sales/quote')->load($quoteId);
$method = $quote->getCheckoutMethod(true);
$customer_email = $order->getCustomerEmail();
if ($method == 'register')
//code to handle if customer just registered to your site
elseif($method == 'guest')
//code to handle if customer is guest
else
//code to handle for logged in customer
Your email check logic looks correct
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);
if($customer && $customer->getId())
// Customer Exist
Then if that all works focus your attention on the following events
sales_order_place_before
adminhtml_sales_order_create_process_data
sales_order_save_after
Also maybe try under <global>
scope instead of <adminhtml>
scope
But I'm confused. As part of the admin create process you need to select a customer record.
So they would never not exist. That's why I included all this other stuff as thought perhaps there is a misunderstanding.
I already defined globally but not getting
– Ankit Dholiya
Jun 6 at 9:09
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%2f277349%2fhow-to-identify-to-customer-is-existing-or-not-in-magento-1-9%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You want the checkout_success event
<events>
<checkout_onepage_controller_success_action>
<observers>
<abandonedcart_observer>
<type>singleton</type>
<class>whatever/observer</class>
<method>doStuff</method>
</abandonedcart_observer>
</observers>
</checkout_onepage_controller_success_action>
</events>
public function doStuff(Varien_Event_Observer $observer)
$orderIds = $observer->getEvent()->getOrderIds();
$collection = Mage::getResourceModel('sales/order_collection')
->addFieldToFilter('entity_id', array('in' => $orderIds));
foreach ($collection as $order)
// do stuff
To demonstrate what you could do you can put some test logic on success phtml to understand more about what's happening and how to tell difference between customers
app/design/frontend/[package]/[theme]/template/checkout/success.phtml
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$quoteId = $order->getQuoteId();
$quote = Mage::getModel('sales/quote')->load($quoteId);
$method = $quote->getCheckoutMethod(true);
$customer_email = $order->getCustomerEmail();
if ($method == 'register')
//code to handle if customer just registered to your site
elseif($method == 'guest')
//code to handle if customer is guest
else
//code to handle for logged in customer
Your email check logic looks correct
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);
if($customer && $customer->getId())
// Customer Exist
Then if that all works focus your attention on the following events
sales_order_place_before
adminhtml_sales_order_create_process_data
sales_order_save_after
Also maybe try under <global>
scope instead of <adminhtml>
scope
But I'm confused. As part of the admin create process you need to select a customer record.
So they would never not exist. That's why I included all this other stuff as thought perhaps there is a misunderstanding.
I already defined globally but not getting
– Ankit Dholiya
Jun 6 at 9:09
add a comment |
You want the checkout_success event
<events>
<checkout_onepage_controller_success_action>
<observers>
<abandonedcart_observer>
<type>singleton</type>
<class>whatever/observer</class>
<method>doStuff</method>
</abandonedcart_observer>
</observers>
</checkout_onepage_controller_success_action>
</events>
public function doStuff(Varien_Event_Observer $observer)
$orderIds = $observer->getEvent()->getOrderIds();
$collection = Mage::getResourceModel('sales/order_collection')
->addFieldToFilter('entity_id', array('in' => $orderIds));
foreach ($collection as $order)
// do stuff
To demonstrate what you could do you can put some test logic on success phtml to understand more about what's happening and how to tell difference between customers
app/design/frontend/[package]/[theme]/template/checkout/success.phtml
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$quoteId = $order->getQuoteId();
$quote = Mage::getModel('sales/quote')->load($quoteId);
$method = $quote->getCheckoutMethod(true);
$customer_email = $order->getCustomerEmail();
if ($method == 'register')
//code to handle if customer just registered to your site
elseif($method == 'guest')
//code to handle if customer is guest
else
//code to handle for logged in customer
Your email check logic looks correct
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);
if($customer && $customer->getId())
// Customer Exist
Then if that all works focus your attention on the following events
sales_order_place_before
adminhtml_sales_order_create_process_data
sales_order_save_after
Also maybe try under <global>
scope instead of <adminhtml>
scope
But I'm confused. As part of the admin create process you need to select a customer record.
So they would never not exist. That's why I included all this other stuff as thought perhaps there is a misunderstanding.
I already defined globally but not getting
– Ankit Dholiya
Jun 6 at 9:09
add a comment |
You want the checkout_success event
<events>
<checkout_onepage_controller_success_action>
<observers>
<abandonedcart_observer>
<type>singleton</type>
<class>whatever/observer</class>
<method>doStuff</method>
</abandonedcart_observer>
</observers>
</checkout_onepage_controller_success_action>
</events>
public function doStuff(Varien_Event_Observer $observer)
$orderIds = $observer->getEvent()->getOrderIds();
$collection = Mage::getResourceModel('sales/order_collection')
->addFieldToFilter('entity_id', array('in' => $orderIds));
foreach ($collection as $order)
// do stuff
To demonstrate what you could do you can put some test logic on success phtml to understand more about what's happening and how to tell difference between customers
app/design/frontend/[package]/[theme]/template/checkout/success.phtml
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$quoteId = $order->getQuoteId();
$quote = Mage::getModel('sales/quote')->load($quoteId);
$method = $quote->getCheckoutMethod(true);
$customer_email = $order->getCustomerEmail();
if ($method == 'register')
//code to handle if customer just registered to your site
elseif($method == 'guest')
//code to handle if customer is guest
else
//code to handle for logged in customer
Your email check logic looks correct
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);
if($customer && $customer->getId())
// Customer Exist
Then if that all works focus your attention on the following events
sales_order_place_before
adminhtml_sales_order_create_process_data
sales_order_save_after
Also maybe try under <global>
scope instead of <adminhtml>
scope
But I'm confused. As part of the admin create process you need to select a customer record.
So they would never not exist. That's why I included all this other stuff as thought perhaps there is a misunderstanding.
You want the checkout_success event
<events>
<checkout_onepage_controller_success_action>
<observers>
<abandonedcart_observer>
<type>singleton</type>
<class>whatever/observer</class>
<method>doStuff</method>
</abandonedcart_observer>
</observers>
</checkout_onepage_controller_success_action>
</events>
public function doStuff(Varien_Event_Observer $observer)
$orderIds = $observer->getEvent()->getOrderIds();
$collection = Mage::getResourceModel('sales/order_collection')
->addFieldToFilter('entity_id', array('in' => $orderIds));
foreach ($collection as $order)
// do stuff
To demonstrate what you could do you can put some test logic on success phtml to understand more about what's happening and how to tell difference between customers
app/design/frontend/[package]/[theme]/template/checkout/success.phtml
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$quoteId = $order->getQuoteId();
$quote = Mage::getModel('sales/quote')->load($quoteId);
$method = $quote->getCheckoutMethod(true);
$customer_email = $order->getCustomerEmail();
if ($method == 'register')
//code to handle if customer just registered to your site
elseif($method == 'guest')
//code to handle if customer is guest
else
//code to handle for logged in customer
Your email check logic looks correct
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);
if($customer && $customer->getId())
// Customer Exist
Then if that all works focus your attention on the following events
sales_order_place_before
adminhtml_sales_order_create_process_data
sales_order_save_after
Also maybe try under <global>
scope instead of <adminhtml>
scope
But I'm confused. As part of the admin create process you need to select a customer record.
So they would never not exist. That's why I included all this other stuff as thought perhaps there is a misunderstanding.
edited Jun 5 at 12:32
answered Jun 5 at 12:27
Dominic XigenDominic Xigen
1,384311
1,384311
I already defined globally but not getting
– Ankit Dholiya
Jun 6 at 9:09
add a comment |
I already defined globally but not getting
– Ankit Dholiya
Jun 6 at 9:09
I already defined globally but not getting
– Ankit Dholiya
Jun 6 at 9:09
I already defined globally but not getting
– Ankit Dholiya
Jun 6 at 9:09
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%2f277349%2fhow-to-identify-to-customer-is-existing-or-not-in-magento-1-9%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