How to get Customers id through company nameTrying to add address information like phone etc but only name,...

What does @RC mean in SSDT SQL Server Unit Testing?

Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?

School performs periodic password audits. Is my password compromised?

How can I create a Table like this in Latex?

Skis versus snow shoes - when to choose which for travelling the backcountry?

Are small insurances worth it

Is there a frame of reference in which I was born before I was conceived?

Is there any relevance to Thor getting his hair cut other than comedic value?

Why is working on the same position for more than 15 years not a red flag?

Borrowing Characters

What is better: yes / no radio, or simple checkbox?

Source for Cremation Specifically Not Jewish

If nine coins are tossed, what is the probability that the number of heads is even?

Canadian citizen, on US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

How to substitute values from a list into a function?

How to evaluate the limit where something is raised to a power of x?

How to make a *empty* field behaves like a *null* field when it comes to standard values?

How to kill a localhost:8080

How do you say "powers of ten"?

A bug in Excel? Conditional formatting for marking duplicates also highlights unique value

Calculating Hyperbolic Sin faster than using a standard power series

Are paired adjectives bad style?

What type of postprocessing gives the effect of people standing out

Wrap all numerics in JSON with quotes



How to get Customers id through company name


Trying to add address information like phone etc but only name, email and password get posted to DBCreate invoice and shipment in magento via cron based on store view and order ageCreate categories through installerSelect the customers logged the last day since an determinated hourDisplay Billing Company in Sales Order GridGet Details of Guest Quote in OPCAdd Company Name from shipping address in sales order gridhow to fetch order number, payment method and customer name according to invoice number in admin panel grid?how to get catalog products filtering attribute code magento 1.9?How to run query subdate(now(), INTERVAL 1 DAY) in Magento Helper













0















Here is my code.



 $user_dataaa = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('company',$row[3])->getData();
echo '<pre>';print_r($user_dataaa);echo '</pre>';









share|improve this question





























    0















    Here is my code.



     $user_dataaa = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('company',$row[3])->getData();
    echo '<pre>';print_r($user_dataaa);echo '</pre>';









    share|improve this question



























      0












      0








      0








      Here is my code.



       $user_dataaa = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('company',$row[3])->getData();
      echo '<pre>';print_r($user_dataaa);echo '</pre>';









      share|improve this question
















      Here is my code.



       $user_dataaa = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('company',$row[3])->getData();
      echo '<pre>';print_r($user_dataaa);echo '</pre>';






      magento-1.9 customer-account






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 17 mins ago









      Teja Bhagavan Kollepara

      2,98641847




      2,98641847










      asked Jan 5 '18 at 12:06









      devildevil

      32




      32






















          2 Answers
          2






          active

          oldest

          votes


















          0














          You assume company is unique? I am not sure about that, if that's not the case you can try something like this, while $company is the company name



          $customerAddresses = Mage::getModel('customer/address')->getCollection();
          $customerAddresses->addAttributeToSelect('company');
          $customerAddresses->addAttributeToFilter('company', array('like' => '%' . $company . '%'));
          foreach ($customerAddresses as $customerAddress){
          print_r($customerAddress->getCustomerId());
          }


          You can change the like statement for an equal if you are sure $company contains the exact value



          $customerAddresses->addAttributeToFilter('company', array('eq' => $company));


          UPDATE



          My mistake, as company is a customer address attribute, not a direct customer attribute. Check above updated code, you'd consider sometimes customer_id could be null, if address is not associated to any customer






          share|improve this answer


























          • thanks for answer.I know company name is not unique but i have only company name to get the details of the customers.

            – devil
            Jan 5 '18 at 12:38













          • and now i got this error after using your code => Invalid attribute name: company

            – devil
            Jan 5 '18 at 12:40











          • I have edited the answer

            – Raul Sanchez
            Jan 5 '18 at 12:48











          • Its Working....You Rocks man :)

            – devil
            Jan 5 '18 at 12:54



















          0














          Try this:



          Get first customer id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          $address = $collection->getFirstItem();
          echo $address->getCustomerId();

          }


          OR



          Get all customers id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          foreach($collection as $address) {
          echo $address->getCustomerId();
          }
          }





          share|improve this answer


























          • i got this error "Invalid attribute name: company".

            – devil
            Jan 5 '18 at 12:35











          • update ans pls check now

            – Abdul
            Jan 5 '18 at 12:53











          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%2f208244%2fhow-to-get-customers-id-through-company-name%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









          0














          You assume company is unique? I am not sure about that, if that's not the case you can try something like this, while $company is the company name



          $customerAddresses = Mage::getModel('customer/address')->getCollection();
          $customerAddresses->addAttributeToSelect('company');
          $customerAddresses->addAttributeToFilter('company', array('like' => '%' . $company . '%'));
          foreach ($customerAddresses as $customerAddress){
          print_r($customerAddress->getCustomerId());
          }


          You can change the like statement for an equal if you are sure $company contains the exact value



          $customerAddresses->addAttributeToFilter('company', array('eq' => $company));


          UPDATE



          My mistake, as company is a customer address attribute, not a direct customer attribute. Check above updated code, you'd consider sometimes customer_id could be null, if address is not associated to any customer






          share|improve this answer


























          • thanks for answer.I know company name is not unique but i have only company name to get the details of the customers.

            – devil
            Jan 5 '18 at 12:38













          • and now i got this error after using your code => Invalid attribute name: company

            – devil
            Jan 5 '18 at 12:40











          • I have edited the answer

            – Raul Sanchez
            Jan 5 '18 at 12:48











          • Its Working....You Rocks man :)

            – devil
            Jan 5 '18 at 12:54
















          0














          You assume company is unique? I am not sure about that, if that's not the case you can try something like this, while $company is the company name



          $customerAddresses = Mage::getModel('customer/address')->getCollection();
          $customerAddresses->addAttributeToSelect('company');
          $customerAddresses->addAttributeToFilter('company', array('like' => '%' . $company . '%'));
          foreach ($customerAddresses as $customerAddress){
          print_r($customerAddress->getCustomerId());
          }


          You can change the like statement for an equal if you are sure $company contains the exact value



          $customerAddresses->addAttributeToFilter('company', array('eq' => $company));


          UPDATE



          My mistake, as company is a customer address attribute, not a direct customer attribute. Check above updated code, you'd consider sometimes customer_id could be null, if address is not associated to any customer






          share|improve this answer


























          • thanks for answer.I know company name is not unique but i have only company name to get the details of the customers.

            – devil
            Jan 5 '18 at 12:38













          • and now i got this error after using your code => Invalid attribute name: company

            – devil
            Jan 5 '18 at 12:40











          • I have edited the answer

            – Raul Sanchez
            Jan 5 '18 at 12:48











          • Its Working....You Rocks man :)

            – devil
            Jan 5 '18 at 12:54














          0












          0








          0







          You assume company is unique? I am not sure about that, if that's not the case you can try something like this, while $company is the company name



          $customerAddresses = Mage::getModel('customer/address')->getCollection();
          $customerAddresses->addAttributeToSelect('company');
          $customerAddresses->addAttributeToFilter('company', array('like' => '%' . $company . '%'));
          foreach ($customerAddresses as $customerAddress){
          print_r($customerAddress->getCustomerId());
          }


          You can change the like statement for an equal if you are sure $company contains the exact value



          $customerAddresses->addAttributeToFilter('company', array('eq' => $company));


          UPDATE



          My mistake, as company is a customer address attribute, not a direct customer attribute. Check above updated code, you'd consider sometimes customer_id could be null, if address is not associated to any customer






          share|improve this answer















          You assume company is unique? I am not sure about that, if that's not the case you can try something like this, while $company is the company name



          $customerAddresses = Mage::getModel('customer/address')->getCollection();
          $customerAddresses->addAttributeToSelect('company');
          $customerAddresses->addAttributeToFilter('company', array('like' => '%' . $company . '%'));
          foreach ($customerAddresses as $customerAddress){
          print_r($customerAddress->getCustomerId());
          }


          You can change the like statement for an equal if you are sure $company contains the exact value



          $customerAddresses->addAttributeToFilter('company', array('eq' => $company));


          UPDATE



          My mistake, as company is a customer address attribute, not a direct customer attribute. Check above updated code, you'd consider sometimes customer_id could be null, if address is not associated to any customer







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 5 '18 at 12:48

























          answered Jan 5 '18 at 12:22









          Raul SanchezRaul Sanchez

          2,10431235




          2,10431235













          • thanks for answer.I know company name is not unique but i have only company name to get the details of the customers.

            – devil
            Jan 5 '18 at 12:38













          • and now i got this error after using your code => Invalid attribute name: company

            – devil
            Jan 5 '18 at 12:40











          • I have edited the answer

            – Raul Sanchez
            Jan 5 '18 at 12:48











          • Its Working....You Rocks man :)

            – devil
            Jan 5 '18 at 12:54



















          • thanks for answer.I know company name is not unique but i have only company name to get the details of the customers.

            – devil
            Jan 5 '18 at 12:38













          • and now i got this error after using your code => Invalid attribute name: company

            – devil
            Jan 5 '18 at 12:40











          • I have edited the answer

            – Raul Sanchez
            Jan 5 '18 at 12:48











          • Its Working....You Rocks man :)

            – devil
            Jan 5 '18 at 12:54

















          thanks for answer.I know company name is not unique but i have only company name to get the details of the customers.

          – devil
          Jan 5 '18 at 12:38







          thanks for answer.I know company name is not unique but i have only company name to get the details of the customers.

          – devil
          Jan 5 '18 at 12:38















          and now i got this error after using your code => Invalid attribute name: company

          – devil
          Jan 5 '18 at 12:40





          and now i got this error after using your code => Invalid attribute name: company

          – devil
          Jan 5 '18 at 12:40













          I have edited the answer

          – Raul Sanchez
          Jan 5 '18 at 12:48





          I have edited the answer

          – Raul Sanchez
          Jan 5 '18 at 12:48













          Its Working....You Rocks man :)

          – devil
          Jan 5 '18 at 12:54





          Its Working....You Rocks man :)

          – devil
          Jan 5 '18 at 12:54













          0














          Try this:



          Get first customer id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          $address = $collection->getFirstItem();
          echo $address->getCustomerId();

          }


          OR



          Get all customers id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          foreach($collection as $address) {
          echo $address->getCustomerId();
          }
          }





          share|improve this answer


























          • i got this error "Invalid attribute name: company".

            – devil
            Jan 5 '18 at 12:35











          • update ans pls check now

            – Abdul
            Jan 5 '18 at 12:53
















          0














          Try this:



          Get first customer id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          $address = $collection->getFirstItem();
          echo $address->getCustomerId();

          }


          OR



          Get all customers id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          foreach($collection as $address) {
          echo $address->getCustomerId();
          }
          }





          share|improve this answer


























          • i got this error "Invalid attribute name: company".

            – devil
            Jan 5 '18 at 12:35











          • update ans pls check now

            – Abdul
            Jan 5 '18 at 12:53














          0












          0








          0







          Try this:



          Get first customer id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          $address = $collection->getFirstItem();
          echo $address->getCustomerId();

          }


          OR



          Get all customers id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          foreach($collection as $address) {
          echo $address->getCustomerId();
          }
          }





          share|improve this answer















          Try this:



          Get first customer id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          $address = $collection->getFirstItem();
          echo $address->getCustomerId();

          }


          OR



          Get all customers id:



          $companyName = "CCC";
          $collection = Mage::getModel('customer/address')->getCollection()
          ->addAttributeToSelect('company')
          ->addAttributeToFilter('company', array('eq' => $companyName));

          if($collection->getSize()) {
          foreach($collection as $address) {
          echo $address->getCustomerId();
          }
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 5 '18 at 12:52

























          answered Jan 5 '18 at 12:26









          AbdulAbdul

          8,14511136




          8,14511136













          • i got this error "Invalid attribute name: company".

            – devil
            Jan 5 '18 at 12:35











          • update ans pls check now

            – Abdul
            Jan 5 '18 at 12:53



















          • i got this error "Invalid attribute name: company".

            – devil
            Jan 5 '18 at 12:35











          • update ans pls check now

            – Abdul
            Jan 5 '18 at 12:53

















          i got this error "Invalid attribute name: company".

          – devil
          Jan 5 '18 at 12:35





          i got this error "Invalid attribute name: company".

          – devil
          Jan 5 '18 at 12:35













          update ans pls check now

          – Abdul
          Jan 5 '18 at 12:53





          update ans pls check now

          – Abdul
          Jan 5 '18 at 12:53


















          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%2f208244%2fhow-to-get-customers-id-through-company-name%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

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...