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;








1















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?










share|improve this question






























    1















    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?










    share|improve this question


























      1












      1








      1








      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?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 3 at 13:55







      yd87

















      asked Jun 3 at 13:08









      yd87yd87

      1084




      1084




















          1 Answer
          1






          active

          oldest

          votes


















          2














          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.






          share|improve this answer























            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%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









            2














            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.






            share|improve this answer



























              2














              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.






              share|improve this answer

























                2












                2








                2







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 3 at 17:29









                HelgeBHelgeB

                3,5782423




                3,5782423



























                    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%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





















































                    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