Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

how to access an attribute value? 
 
thesleepless
Jr. Member
 
Total Posts:  4
Joined:  2008-09-22
 

hi, i’m subclassing the shipping model and during collect rates i want to get the values of certain attributes of the items in the cart
the attributes don’t seem to have a getValue() method, does anyone know how to access them?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alekc
Jr. Member
 
Total Posts:  20
Joined:  2008-05-29
 

Well, there is another option ($_product->getAttributeName()), but i suppose that if you cant get it with both methods it mean that product collection is missing your custom attributes so you will need to add them with addAttributeToSelect

 
Magento Community Magento Community
Magento Community
Magento Community
 
thesleepless
Jr. Member
 
Total Posts:  4
Joined:  2008-09-22
 

hmm i think that could be the problem, i’m not entirely sure.

when i use $product->getData(’cust_attr_name’) in the design templates theres no problem;
but inside the shipping carrier using

$items = $request->getAllItems();
foreach($items as $item) {
var_dump($item->getProduct()->getData(’cust_attr_name’));
}

always shows NULL.

any idea how to get the data to load into the product?
it works for things like name and weight and price, but not my custom ones

 
Magento Community Magento Community
Magento Community
Magento Community
 
jonasfr
Member
 
Total Posts:  31
Joined:  2008-09-27
 

hey there,

that would be interesting to me, too.

i try to access custom attributes from the cart.phtml and it returns NULL. where should we add the nedded attribute name through addAttributeToSelect? in the navigation .php i did it for another usage before - it works. but for the cart?

thanks for any help,

jonas

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top