search
top

Get Table Name in Magento

I am writing here a small but useful snippet of code, for getting the table name of any module (whose table name are defined in config file).

This is very useful when using joins in query.

Suppose my module is ‘vendor’.

<?php

$resource = Mage::getSingleton('core/resource');
$tableName = $resource->getTableName('vendor/vendor');


?>

2 Responses to “Get Table Name in Magento”

  1. Visvanathan says:

    Hi! i need to see list of table name in Sales Order

    $getQuote = Mage::getSingleton(‘sales/order’);
    $getTableName = $getQuote->getTableName(‘sales/sales’);
    print_r($getTableName);

    is it correct way? but it not work me

Leave a Reply

top