Magento 1.9 Orders – Get Sales Order Attributes Collection

attributescollection;magento-1.9orders

I want all the attributes of sales/order with their name and front-end label.
I've tried following. But its not working.

Mage::getResourceModel('sales/order_attribute_collection');

By following code i was able to get all the fields. But its not giving me Front-end labels. I want front-end labels as well…

$resource       = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');  
$tableName      = $resource->getTableName('sales/order');
$salesfield     = $readConnection->describeTable($tableName);

Thanks.

EDIT :
Browsing following folder structure

1. app\code\core\Mage\Sales\Model\Resource\Order\Attribute
2. app\code\core\Mage\Sales\Model\Entity\Order\Attribute
3. app\code\core\Mage\Sales\Model\Mysql4\Order\Attribute

I found Attribute folder does not have collection.php file like 'catalog/product' or 'customer' modules have.

Best Answer

What you want to achieve is a little bit complex.

In the past Magentos quote, invoice, credit memo and shipping were EAV tables, but this changed I think from 1.5 to 1.6. So the orders doesn't have attributes anymore, as you can see, when you check the table eav_attribute. You still find an entry in eav_entity_type but no reference in the attribute table.

Therefore there is no way to get this automatically and the "frontend labels" are just translated strings.

Related Topic