i am using Magento 1.9.0.1 and i am developing a custom extension.
Right now i am stuck at the following thing.
Like this i use to get the customers name from an order:
$CustomerName = $observer->getOrder()->getBillingAddress()->getName();
I have custom customer attribute called sms_on_order_change
and i am trying to get the value of it like that:
$SMSOnStatusChange = $observer->getResource()->getAttribute('sms_on_order_change')->getFrontend()->getValue();
But it is not working.
Here is the extension that i am using for the creation of custom customer attributes: http://www.magentocommerce.com/magento-connect/manage-customer-attributes.html
So guys, can you help me out so i can get the value of this custom attribute ?
Thanks in advance!
This should help you out:
//get order from observer
$order = $observer->getOrder();
// get customer id from order
$customer_id = $order->getCustomerId();
// condition only necessary if guest orders are allowed
if ($customer_id)
{
$_customer = Mage::getModel('customer/customer')->load($customer_id);
$sms_on_order_change = $_customer->getData('sms_on_order_change');
}