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;








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;









share|improve this question






























    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;









    share|improve this question


























      0












      0








      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;









      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 5 at 12:02







      Ankit Dholiya

















      asked Jun 5 at 11:31









      Ankit DholiyaAnkit Dholiya

      64




      64




















          1 Answer
          1






          active

          oldest

          votes


















          0














          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.






          share|improve this answer

























          • I already defined globally but not getting

            – Ankit Dholiya
            Jun 6 at 9:09











          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
          );



          );













          draft saved

          draft discarded


















          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









          0














          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.






          share|improve this answer

























          • I already defined globally but not getting

            – Ankit Dholiya
            Jun 6 at 9:09















          0














          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.






          share|improve this answer

























          • I already defined globally but not getting

            – Ankit Dholiya
            Jun 6 at 9:09













          0












          0








          0







          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.






          share|improve this answer















          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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

















          • 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

















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form