How is a product name retrieved if the query does not return it in the result set?Product Collection for Default CategoryHow to get Search result Product collection outside result.phtmlMagento Customer Attribute Not ShowingHow to remove attribute from Product CollectionMagento: How to get customer last order by joining customers and orders?How to disable search by SKU (for specific store)?addAttributeToSelect() does not work for newly created attributesMagento 2 : AND condition in addAttributeToFilter not giving desired resultInclude associated products when checking if product is discounted to show sales tag in listcustom table left join with catalog/product
How can I spread content from an ancient text without governmental supervision?
How to write a convincing religious myth?
Solving ‘Null geometry…’ error during distance matrix operation?
Proving that a Russian cryptographic standard is too structured
A map of non-pathological topology?
C++ logging library
Write a function that checks if a string starts with or contains something
Is the use of umgeben in the passive unusual?
What is this Amiga 1200 mod?
TicTacToe classic in C
Does a bank have to tell me if a check made out to me was cashed there?
If there's something that implicates the president why is there then a national security issue? (John Dowd)
Is there a DSLR/mirorless camera with minimal options like a classic, simple SLR?
How do free-speech protections in the United States apply in public to corporate misrepresentations?
Is it safe to change the harddrive power feature so that it never turns off?
Amplitude of a crest and trough in a sound wave?
Sql Server delete syntax
Origin of "boor"
Why did the World Bank set the global poverty line at $1.90?
Was Self-modifying-code possible just using BASIC?
Why am I getting a strange double quote (“) in Open Office instead of the ordinary one (")?
Grep Match and extract
Do you need to let the DM know when you are multiclassing?
How to befriend someone who doesn't like to talk?
How is a product name retrieved if the query does not return it in the result set?
Product Collection for Default CategoryHow to get Search result Product collection outside result.phtmlMagento Customer Attribute Not ShowingHow to remove attribute from Product CollectionMagento: How to get customer last order by joining customers and orders?How to disable search by SKU (for specific store)?addAttributeToSelect() does not work for newly created attributesMagento 2 : AND condition in addAttributeToFilter not giving desired resultInclude associated products when checking if product is discounted to show sales tag in listcustom table left join with catalog/product
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to get data from catalog_product EAV tables with the following code:
$productCollection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', ['eq' => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE])
->addAttributeToFilter('status', ['eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED])
->addAttributeToSelect('some_custom_attribute')
->addAttributeToSelect('name');
as you can see above, I have also called for some_custom_attribute
to be sent with the result of the query.
Associated query for the above collection from getSelect()
returns:
SELECT `e`.*, `at_status`.`value` AS `status` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '96') AND (`at_status`.`store_id` = 0) WHERE (`e`.`type_id` = 'configurable') AND (at_status.value = 1))
The result of the query does not contain the name. However, when I do the following:
foreach ($productCollection as $product) {
echo "Product is: ".$product->getId()." with name ".$product->getName()." with value of custom attribute ".$product->getSomeCustomAttribute()."n";
It returns me the correct name of the product even though the name was not received as part of the query.
How is it that I'm able to get the value of name and some_custom_attribute even though the query result does not contain those columns?
magento-1.9 collection eav eav-attributes
add a comment |
I'm trying to get data from catalog_product EAV tables with the following code:
$productCollection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', ['eq' => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE])
->addAttributeToFilter('status', ['eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED])
->addAttributeToSelect('some_custom_attribute')
->addAttributeToSelect('name');
as you can see above, I have also called for some_custom_attribute
to be sent with the result of the query.
Associated query for the above collection from getSelect()
returns:
SELECT `e`.*, `at_status`.`value` AS `status` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '96') AND (`at_status`.`store_id` = 0) WHERE (`e`.`type_id` = 'configurable') AND (at_status.value = 1))
The result of the query does not contain the name. However, when I do the following:
foreach ($productCollection as $product) {
echo "Product is: ".$product->getId()." with name ".$product->getName()." with value of custom attribute ".$product->getSomeCustomAttribute()."n";
It returns me the correct name of the product even though the name was not received as part of the query.
How is it that I'm able to get the value of name and some_custom_attribute even though the query result does not contain those columns?
magento-1.9 collection eav eav-attributes
add a comment |
I'm trying to get data from catalog_product EAV tables with the following code:
$productCollection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', ['eq' => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE])
->addAttributeToFilter('status', ['eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED])
->addAttributeToSelect('some_custom_attribute')
->addAttributeToSelect('name');
as you can see above, I have also called for some_custom_attribute
to be sent with the result of the query.
Associated query for the above collection from getSelect()
returns:
SELECT `e`.*, `at_status`.`value` AS `status` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '96') AND (`at_status`.`store_id` = 0) WHERE (`e`.`type_id` = 'configurable') AND (at_status.value = 1))
The result of the query does not contain the name. However, when I do the following:
foreach ($productCollection as $product) {
echo "Product is: ".$product->getId()." with name ".$product->getName()." with value of custom attribute ".$product->getSomeCustomAttribute()."n";
It returns me the correct name of the product even though the name was not received as part of the query.
How is it that I'm able to get the value of name and some_custom_attribute even though the query result does not contain those columns?
magento-1.9 collection eav eav-attributes
I'm trying to get data from catalog_product EAV tables with the following code:
$productCollection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', ['eq' => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE])
->addAttributeToFilter('status', ['eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED])
->addAttributeToSelect('some_custom_attribute')
->addAttributeToSelect('name');
as you can see above, I have also called for some_custom_attribute
to be sent with the result of the query.
Associated query for the above collection from getSelect()
returns:
SELECT `e`.*, `at_status`.`value` AS `status` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '96') AND (`at_status`.`store_id` = 0) WHERE (`e`.`type_id` = 'configurable') AND (at_status.value = 1))
The result of the query does not contain the name. However, when I do the following:
foreach ($productCollection as $product) {
echo "Product is: ".$product->getId()." with name ".$product->getName()." with value of custom attribute ".$product->getSomeCustomAttribute()."n";
It returns me the correct name of the product even though the name was not received as part of the query.
How is it that I'm able to get the value of name and some_custom_attribute even though the query result does not contain those columns?
magento-1.9 collection eav eav-attributes
magento-1.9 collection eav eav-attributes
edited Jun 3 at 13:55
yd87
asked Jun 3 at 13:08
yd87yd87
1084
1084
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The main select contains only the data from the entity table (catalog_product_entity
which happens your case) or the flat table if you have enabled the option to use flat tables for product data
(catalog_product_flat_X
for example catalog_product_flat_1
for store 1). in the latter case the attributes would be listed in the main select.
If you don't use flat tables for product data, the loading of the attribute data from the eav tables is done after the loading of the entity in a separate method.
Please check the method Mage_Eav_Model_Entity_Collection_Abstract::load()
for details:
There you can see a call $this->_loadEntities($printQuery, $logQuery);
which loads the entity data and a second call $this->_loadAttributes($printQuery, $logQuery);
which loads the eav attribute data and adds it to the corresponding collection item.
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%2f277090%2fhow-is-a-product-name-retrieved-if-the-query-does-not-return-it-in-the-result-se%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
The main select contains only the data from the entity table (catalog_product_entity
which happens your case) or the flat table if you have enabled the option to use flat tables for product data
(catalog_product_flat_X
for example catalog_product_flat_1
for store 1). in the latter case the attributes would be listed in the main select.
If you don't use flat tables for product data, the loading of the attribute data from the eav tables is done after the loading of the entity in a separate method.
Please check the method Mage_Eav_Model_Entity_Collection_Abstract::load()
for details:
There you can see a call $this->_loadEntities($printQuery, $logQuery);
which loads the entity data and a second call $this->_loadAttributes($printQuery, $logQuery);
which loads the eav attribute data and adds it to the corresponding collection item.
add a comment |
The main select contains only the data from the entity table (catalog_product_entity
which happens your case) or the flat table if you have enabled the option to use flat tables for product data
(catalog_product_flat_X
for example catalog_product_flat_1
for store 1). in the latter case the attributes would be listed in the main select.
If you don't use flat tables for product data, the loading of the attribute data from the eav tables is done after the loading of the entity in a separate method.
Please check the method Mage_Eav_Model_Entity_Collection_Abstract::load()
for details:
There you can see a call $this->_loadEntities($printQuery, $logQuery);
which loads the entity data and a second call $this->_loadAttributes($printQuery, $logQuery);
which loads the eav attribute data and adds it to the corresponding collection item.
add a comment |
The main select contains only the data from the entity table (catalog_product_entity
which happens your case) or the flat table if you have enabled the option to use flat tables for product data
(catalog_product_flat_X
for example catalog_product_flat_1
for store 1). in the latter case the attributes would be listed in the main select.
If you don't use flat tables for product data, the loading of the attribute data from the eav tables is done after the loading of the entity in a separate method.
Please check the method Mage_Eav_Model_Entity_Collection_Abstract::load()
for details:
There you can see a call $this->_loadEntities($printQuery, $logQuery);
which loads the entity data and a second call $this->_loadAttributes($printQuery, $logQuery);
which loads the eav attribute data and adds it to the corresponding collection item.
The main select contains only the data from the entity table (catalog_product_entity
which happens your case) or the flat table if you have enabled the option to use flat tables for product data
(catalog_product_flat_X
for example catalog_product_flat_1
for store 1). in the latter case the attributes would be listed in the main select.
If you don't use flat tables for product data, the loading of the attribute data from the eav tables is done after the loading of the entity in a separate method.
Please check the method Mage_Eav_Model_Entity_Collection_Abstract::load()
for details:
There you can see a call $this->_loadEntities($printQuery, $logQuery);
which loads the entity data and a second call $this->_loadAttributes($printQuery, $logQuery);
which loads the eav attribute data and adds it to the corresponding collection item.
answered Jun 3 at 17:29
HelgeBHelgeB
3,5782423
3,5782423
add a comment |
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%2f277090%2fhow-is-a-product-name-retrieved-if-the-query-does-not-return-it-in-the-result-se%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