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;
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
add a comment |
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
add a comment |
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
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
magento-1.9 attributes grid customer-attribute
asked May 10 at 13:34
RyanRyan
1337
1337
add a comment |
add a comment |
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
);
);
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%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
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%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
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