Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all field names from magento model

Tags:

php

magento

How can I get all field names from an object like "order" without creating or loading this object?

Example:

Model: sales/order

With a loaded order and the getData() method I get an array of various field names like:

shipping_tax_amount
grand_total
base_tax_amount

How can I get these field names without an order? In my case it must be possible to access to this fields even if there is no order at the magento shop.

like image 460
Stefan Brendle Avatar asked Aug 11 '14 14:08

Stefan Brendle


1 Answers

  $resource = Mage::getSingleton('core/resource');
   $readConnection = $resource->getConnection('core_read');  
    /**
     * Get the table name
     */
    $tableName = $resource->getTableName('sales/order');

$saleafield=$readConnection->describeTable($tableName);
var_dump($saleafield);
like image 152
Amit Bera Avatar answered Nov 09 '22 13:11

Amit Bera