value of specific group attributes of product
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
add a comment |
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
add a comment |
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
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
product attributes attribute-set
edited May 1 '15 at 15:50
David Manners
24.7k862212
24.7k862212
asked Nov 13 '14 at 2:32
mcodermcoder
40811031
40811031
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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.
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%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
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.
add a comment |
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.
add a comment |
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.
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.
answered May 1 '15 at 15:50
David MannersDavid Manners
24.7k862212
24.7k862212
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
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
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%2f43807%2fvalue-of-specific-group-attributes-of-product%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