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

Call an attribute value
 
netstralogy
Jr. Member
 
Total Posts:  29
Joined:  2008-04-09
 

I’m trying to set up our shipping to where if a customer orders a particular item, they will be charged a fixed amount for additional shipping.  So what we did was add an attribute called Additional Shipping Charges.  How do we call the value in the attribute so that we can modify that shipping calculations to where if an item has a value in Additional Shipping Charges, it will be added in the calculation?

We just need to know where or how to call the value of an attribute.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

Netstalogy,
Magento uses PHP’s Method Overloading __call function on the getProduct object to get attribute values. Try this:

function getAdditionalShippingCharges() {
        $product 
$this->getProduct();
        return 
intval($product->getAdditionalShippingCharges());
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top