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

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

                    Log in Navigation menu

                    Invalid response line returned from server: HTTP/2 401 | ErrorPlease Please Help With Error 500 Internal Server Error after upgrading from 1.7 to 1.9Unable to place new customer orders in admin backendMagento - For “Manage Categories” Forbidden You do not have permission to access this documentHTTP ERROR 500 when using require(_once) app/Mage.phpMemcached causing Web Setup Wizard ErrorCould not create an acl object: Invalid XMLAn error occurred on the server. Please try to place the order againInvalid response line returned from server: HTTP/2 200 - message after update to 2.1.7Magento-CE 2.3.0 installation error on XamppMagento 2.2.6- After Migration all default Payment Methods are not working fine