I have Magento 1.9. I have to get the value of the custom attribute of an order item. I already have the product like this:
$product = Mage::getModel("catalog/product") -> load($p -> ID);
and this is fine (I logged it, and the object is product object is ok). To get the custom attribute value, I tried this, and none worked:
error_log("DEV 1:" . print_r($product -> getData("ds_dropship_product_id"), true));
error_log("DEV 2:" . print_r($product -> getDsDropshipProductId(), true));
error_log("DEV 3:" . print_r($product -> getAttributeText("ds_dropship_product_id"), true));
$attribute_code="ds_dropship_product_id"; // attribute with text value
$some = $product -> getDsDropshipProductId();
error_log("DEV 4:" . $some);
error_log("DEV 5:" . print_r($some, true));
$attribute_value = Mage::getResourceModel('catalog/product')->getAttributeRawValue($p -> ID, $attribute_code, 1);
error_log("DEV 6:" . $attribute_value);
$description_attribute = $product->getResource()->getAttribute($attribute_code);
error_log("DEV 7: " . var_dump($description_attribute));
//error_log("DEV 8" . print_r($description_attribute, true));
$description_attribute_value = $description_attribute ->getFrontend()->getValue($product);
error_log("DEV 9" . $description_attribute_value);
error_log("DEV 10" . $product->getData($attribute_code));
error_log("DEV 11" . $product->getResource()->getAttributeRawValue($product->getId(), $attribute_code, $product->getStoreId()));
$attribute_code="ds_dropship_product_id";
error_log("DEV 12" . $product->getAttributeText($attribute_code));
error_log("DEV 13" . $product->getResource()->getAttribute($attribute_code)->getDefaultFrontendLabel());
error_log("DEV 14" . $product->getResource()->getAttribute($attribute_code)->getStoreLabel());
error_log("DEV 15" . $product->getResource()->getAttribute($attribute_code)->getFrontendInput());
Do you know any other known way to do this?