value of specific group attributes of product












1















in manage attributes set say default i created a group say "my custom group" now i want to get value of all attributes under this group for current product how can i do this?..



$attributeValue = Mage::getModel('catalog/product')
->load($this->getProduct()->getId());
echo "<pre>";
print_r($attributeValue->getData());
echo "</pre>";


show all attributes for product










share|improve this question





























    1















    in manage attributes set say default i created a group say "my custom group" now i want to get value of all attributes under this group for current product how can i do this?..



    $attributeValue = Mage::getModel('catalog/product')
    ->load($this->getProduct()->getId());
    echo "<pre>";
    print_r($attributeValue->getData());
    echo "</pre>";


    show all attributes for product










    share|improve this question



























      1












      1








      1








      in manage attributes set say default i created a group say "my custom group" now i want to get value of all attributes under this group for current product how can i do this?..



      $attributeValue = Mage::getModel('catalog/product')
      ->load($this->getProduct()->getId());
      echo "<pre>";
      print_r($attributeValue->getData());
      echo "</pre>";


      show all attributes for product










      share|improve this question
















      in manage attributes set say default i created a group say "my custom group" now i want to get value of all attributes under this group for current product how can i do this?..



      $attributeValue = Mage::getModel('catalog/product')
      ->load($this->getProduct()->getId());
      echo "<pre>";
      print_r($attributeValue->getData());
      echo "</pre>";


      show all attributes for product







      product attributes attribute-set






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 1 '15 at 15:50









      David Manners

      24.7k862212




      24.7k862212










      asked Nov 13 '14 at 2:32









      mcodermcoder

      40811031




      40811031






















          2 Answers
          2






          active

          oldest

          votes


















          2














          If you know the product attribute group id then you can load all the attributes that are in this group via the following code snippet ($group_id is the group id):



          $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
          ->setAttributeGroupFilter($group_id)
          ->checkConfigurableProducts();


          This should give you a collection of all the attributes in this group. You can then loop through this collection and set a value against the product for each attribute.



          There is probably a smart way to use this collection and set values for a product without looping through the collection but I am not sure how to do it.






          share|improve this answer































            1














            You can not fetch the Attributes values as per group.



            Magento Follow the EAV Model.



            So if you want to access the value form any Custom attribute value for that product then you have to follow the Magento Standard Way as below.



            Syntax




            $product=Mage::getModel('catalog/product')->load($Id);




            Once you write above line the it will fetch all data for that product. Now you want to fetch the value of any attributes like name, color or any other attributes then use below code.




            $product->getData('Attribute Code');




            Or




            $product->getName();




            This way you can access the details of any attributes.






            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%2f43807%2fvalue-of-specific-group-attributes-of-product%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              If you know the product attribute group id then you can load all the attributes that are in this group via the following code snippet ($group_id is the group id):



              $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
              ->setAttributeGroupFilter($group_id)
              ->checkConfigurableProducts();


              This should give you a collection of all the attributes in this group. You can then loop through this collection and set a value against the product for each attribute.



              There is probably a smart way to use this collection and set values for a product without looping through the collection but I am not sure how to do it.






              share|improve this answer




























                2














                If you know the product attribute group id then you can load all the attributes that are in this group via the following code snippet ($group_id is the group id):



                $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
                ->setAttributeGroupFilter($group_id)
                ->checkConfigurableProducts();


                This should give you a collection of all the attributes in this group. You can then loop through this collection and set a value against the product for each attribute.



                There is probably a smart way to use this collection and set values for a product without looping through the collection but I am not sure how to do it.






                share|improve this answer


























                  2












                  2








                  2







                  If you know the product attribute group id then you can load all the attributes that are in this group via the following code snippet ($group_id is the group id):



                  $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
                  ->setAttributeGroupFilter($group_id)
                  ->checkConfigurableProducts();


                  This should give you a collection of all the attributes in this group. You can then loop through this collection and set a value against the product for each attribute.



                  There is probably a smart way to use this collection and set values for a product without looping through the collection but I am not sure how to do it.






                  share|improve this answer













                  If you know the product attribute group id then you can load all the attributes that are in this group via the following code snippet ($group_id is the group id):



                  $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
                  ->setAttributeGroupFilter($group_id)
                  ->checkConfigurableProducts();


                  This should give you a collection of all the attributes in this group. You can then loop through this collection and set a value against the product for each attribute.



                  There is probably a smart way to use this collection and set values for a product without looping through the collection but I am not sure how to do it.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 1 '15 at 15:50









                  David MannersDavid Manners

                  24.7k862212




                  24.7k862212

























                      1














                      You can not fetch the Attributes values as per group.



                      Magento Follow the EAV Model.



                      So if you want to access the value form any Custom attribute value for that product then you have to follow the Magento Standard Way as below.



                      Syntax




                      $product=Mage::getModel('catalog/product')->load($Id);




                      Once you write above line the it will fetch all data for that product. Now you want to fetch the value of any attributes like name, color or any other attributes then use below code.




                      $product->getData('Attribute Code');




                      Or




                      $product->getName();




                      This way you can access the details of any attributes.






                      share|improve this answer






























                        1














                        You can not fetch the Attributes values as per group.



                        Magento Follow the EAV Model.



                        So if you want to access the value form any Custom attribute value for that product then you have to follow the Magento Standard Way as below.



                        Syntax




                        $product=Mage::getModel('catalog/product')->load($Id);




                        Once you write above line the it will fetch all data for that product. Now you want to fetch the value of any attributes like name, color or any other attributes then use below code.




                        $product->getData('Attribute Code');




                        Or




                        $product->getName();




                        This way you can access the details of any attributes.






                        share|improve this answer




























                          1












                          1








                          1







                          You can not fetch the Attributes values as per group.



                          Magento Follow the EAV Model.



                          So if you want to access the value form any Custom attribute value for that product then you have to follow the Magento Standard Way as below.



                          Syntax




                          $product=Mage::getModel('catalog/product')->load($Id);




                          Once you write above line the it will fetch all data for that product. Now you want to fetch the value of any attributes like name, color or any other attributes then use below code.




                          $product->getData('Attribute Code');




                          Or




                          $product->getName();




                          This way you can access the details of any attributes.






                          share|improve this answer















                          You can not fetch the Attributes values as per group.



                          Magento Follow the EAV Model.



                          So if you want to access the value form any Custom attribute value for that product then you have to follow the Magento Standard Way as below.



                          Syntax




                          $product=Mage::getModel('catalog/product')->load($Id);




                          Once you write above line the it will fetch all data for that product. Now you want to fetch the value of any attributes like name, color or any other attributes then use below code.




                          $product->getData('Attribute Code');




                          Or




                          $product->getName();




                          This way you can access the details of any attributes.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 28 mins ago









                          Teja Bhagavan Kollepara

                          3,01241949




                          3,01241949










                          answered Nov 13 '14 at 6:01









                          Keyul ShahKeyul Shah

                          6,59963058




                          6,59963058






























                              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%2f43807%2fvalue-of-specific-group-attributes-of-product%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

                              What other Star Trek series did the main TNG cast show up in?

                              Berlina muro

                              Berlina aerponto