How to filter a customer boolean attribute on the admin invoice grid(Magento 1.9)?Custom Customer Attribute (string) get function not workingmagento admin grid show data in column from model methodHow to add extension attributes to Customer entity in Magento2?How to get attributes of product from collection with our custom attribute property condition in magentoWhile Exporting CSV from Sales > Order Grid, I am getting error - “You cannot define a correlation name 'order' more than once”Magento 2 - Display eav attribute in customer grid (explanation & questions)filter_condition_callback function not called in observerMagento - Add customer attribute to order gridMagento 2 Show customer attribute in ui_component formGetting error when show “out of stock” products in last

Can anyone give me examples of the relative-determinative 'which'?

Does it matter what way the tires go if no directional arrow?

Holding rent money for my friend which amounts to over $10k?

Is my test coverage up to snuff?

Would life always name the light from their sun "white"

Is random forest for regression a 'true' regression?

Does the wearer know what items are in which patch in the Robe of Useful items?

Testing blind license applicants

What was Varys trying to do at the beginning of S08E05?

Why did the metro bus stop at each railway crossing, despite no warning indicating a train was coming?

Why did the soldiers of the North disobey Jon?

Formal Definition of Dot Product

Should I communicate in my applications that I'm unemployed out of choice rather than because nobody will have me?

Which creature is depicted in this Xanathar's Guide illustration of a war mage?

What metal is most suitable for a ladder submerged in an underground water tank?

Why when I add jam to my tea it stops producing thin "membrane" on top?

labelled end points on logic diagram

Are there microwaves to heat baby food at Brussels airport?

Does this "yield your space to an ally" rule my 3.5 group uses appear anywhere in the official rules?

Does addError() work outside of triggers?

Developers demotivated due to working on same project for more than 2 years

Wireless headphones interfere with Wi-Fi signal on laptop

How to describe a building set which is like LEGO without using the "LEGO" word?

Why commonly or frequently used fonts sizes are even numbers like 10px, 12px, 16px, 24px, or 32px?



How to filter a customer boolean attribute on the admin invoice grid(Magento 1.9)?


Custom Customer Attribute (string) get function not workingmagento admin grid show data in column from model methodHow to add extension attributes to Customer entity in Magento2?How to get attributes of product from collection with our custom attribute property condition in magentoWhile Exporting CSV from Sales > Order Grid, I am getting error - “You cannot define a correlation name 'order' more than once”Magento 2 - Display eav attribute in customer grid (explanation & questions)filter_condition_callback function not called in observerMagento - Add customer attribute to order gridMagento 2 Show customer attribute in ui_component formGetting error when show “out of stock” products in last






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I can successfully display a Yes or No for my customer boolean attribute on the admin invoice grid using the following code. Here's the collection setup:



$entityType = 'customer';
$attributeCode = 'myfoo';
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode($entityType, $attributeCode);
$resource = Mage::getSingleton('core/resource');
$ceTable = $resource->getTableName($entityType . '_entity_' . $attribute->getBackendType());

$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()
->join(
array('sfo' => 'sales_flat_order'),
'main_table.order_id = sfo.entity_id',
array('customer_email'))

//join I added to get the boolean customer attribute value
->joinLeft(
array('ce2' => $ceTable),
'ce2.entity_id = sfo.customer_id AND ce2.attribute_id = ' . $attribute->getId(),
array($attributeCode => 'if(ce2.value, "Yes", "No")'));


And then the column display:



$this->addColumn('myfoo', array(
'header' => Mage::helper('sales')->__('My Foo'),
'index' => 'myfoo',
'type' => 'text'
));


But how do I make it filterable? The admin should be able to type a Yes or No at the top of the column and then only see Yes columns or only see No columns. I've tried various filter_index and filter_condition_callback setups but I can't get anything to work.



A note on this attribute value in the database: it's either null, 0 or 1. If it's null or 0 then it's No and if it's 1 then it's Yes. That's why I have this line:



$attributeCode => 'if(ce2.value, "Yes", "No")'









share|improve this question




























    0















    I can successfully display a Yes or No for my customer boolean attribute on the admin invoice grid using the following code. Here's the collection setup:



    $entityType = 'customer';
    $attributeCode = 'myfoo';
    $attribute = Mage::getModel('eav/entity_attribute')->loadByCode($entityType, $attributeCode);
    $resource = Mage::getSingleton('core/resource');
    $ceTable = $resource->getTableName($entityType . '_entity_' . $attribute->getBackendType());

    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection->getSelect()
    ->join(
    array('sfo' => 'sales_flat_order'),
    'main_table.order_id = sfo.entity_id',
    array('customer_email'))

    //join I added to get the boolean customer attribute value
    ->joinLeft(
    array('ce2' => $ceTable),
    'ce2.entity_id = sfo.customer_id AND ce2.attribute_id = ' . $attribute->getId(),
    array($attributeCode => 'if(ce2.value, "Yes", "No")'));


    And then the column display:



    $this->addColumn('myfoo', array(
    'header' => Mage::helper('sales')->__('My Foo'),
    'index' => 'myfoo',
    'type' => 'text'
    ));


    But how do I make it filterable? The admin should be able to type a Yes or No at the top of the column and then only see Yes columns or only see No columns. I've tried various filter_index and filter_condition_callback setups but I can't get anything to work.



    A note on this attribute value in the database: it's either null, 0 or 1. If it's null or 0 then it's No and if it's 1 then it's Yes. That's why I have this line:



    $attributeCode => 'if(ce2.value, "Yes", "No")'









    share|improve this question
























      0












      0








      0








      I can successfully display a Yes or No for my customer boolean attribute on the admin invoice grid using the following code. Here's the collection setup:



      $entityType = 'customer';
      $attributeCode = 'myfoo';
      $attribute = Mage::getModel('eav/entity_attribute')->loadByCode($entityType, $attributeCode);
      $resource = Mage::getSingleton('core/resource');
      $ceTable = $resource->getTableName($entityType . '_entity_' . $attribute->getBackendType());

      $collection = Mage::getResourceModel($this->_getCollectionClass());
      $collection->getSelect()
      ->join(
      array('sfo' => 'sales_flat_order'),
      'main_table.order_id = sfo.entity_id',
      array('customer_email'))

      //join I added to get the boolean customer attribute value
      ->joinLeft(
      array('ce2' => $ceTable),
      'ce2.entity_id = sfo.customer_id AND ce2.attribute_id = ' . $attribute->getId(),
      array($attributeCode => 'if(ce2.value, "Yes", "No")'));


      And then the column display:



      $this->addColumn('myfoo', array(
      'header' => Mage::helper('sales')->__('My Foo'),
      'index' => 'myfoo',
      'type' => 'text'
      ));


      But how do I make it filterable? The admin should be able to type a Yes or No at the top of the column and then only see Yes columns or only see No columns. I've tried various filter_index and filter_condition_callback setups but I can't get anything to work.



      A note on this attribute value in the database: it's either null, 0 or 1. If it's null or 0 then it's No and if it's 1 then it's Yes. That's why I have this line:



      $attributeCode => 'if(ce2.value, "Yes", "No")'









      share|improve this question














      I can successfully display a Yes or No for my customer boolean attribute on the admin invoice grid using the following code. Here's the collection setup:



      $entityType = 'customer';
      $attributeCode = 'myfoo';
      $attribute = Mage::getModel('eav/entity_attribute')->loadByCode($entityType, $attributeCode);
      $resource = Mage::getSingleton('core/resource');
      $ceTable = $resource->getTableName($entityType . '_entity_' . $attribute->getBackendType());

      $collection = Mage::getResourceModel($this->_getCollectionClass());
      $collection->getSelect()
      ->join(
      array('sfo' => 'sales_flat_order'),
      'main_table.order_id = sfo.entity_id',
      array('customer_email'))

      //join I added to get the boolean customer attribute value
      ->joinLeft(
      array('ce2' => $ceTable),
      'ce2.entity_id = sfo.customer_id AND ce2.attribute_id = ' . $attribute->getId(),
      array($attributeCode => 'if(ce2.value, "Yes", "No")'));


      And then the column display:



      $this->addColumn('myfoo', array(
      'header' => Mage::helper('sales')->__('My Foo'),
      'index' => 'myfoo',
      'type' => 'text'
      ));


      But how do I make it filterable? The admin should be able to type a Yes or No at the top of the column and then only see Yes columns or only see No columns. I've tried various filter_index and filter_condition_callback setups but I can't get anything to work.



      A note on this attribute value in the database: it's either null, 0 or 1. If it's null or 0 then it's No and if it's 1 then it's Yes. That's why I have this line:



      $attributeCode => 'if(ce2.value, "Yes", "No")'






      magento-1.9 attributes grid customer-attribute






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 10 at 13:34









      RyanRyan

      1337




      1337




















          0






          active

          oldest

          votes












          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%2f274181%2fhow-to-filter-a-customer-boolean-attribute-on-the-admin-invoice-gridmagento-1-9%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          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%2f274181%2fhow-to-filter-a-customer-boolean-attribute-on-the-admin-invoice-gridmagento-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

          Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

          Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

          Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림