Magento: Get store contact telephone

Magento: Get store contact telephone

July 27, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: Get store contact telephone

Retrieving Store Contact Telephone in Magento: Complete Guide

Are you struggling to output your store’s contact telephone number across your Magento templates and CMS pages? You’re not alone! The process might seem straightforward, but Magento’s architecture requires a specific approach. Let me guide you through this common challenge.

Understanding the Store Configuration

Firstly, it’s crucial to understand where the store contact information is stored in Magento. This data resides within the core_config_data table under the path general/store_information/phone.

However, accessing this directly via SQL queries isn’t recommended due to performance implications and security concerns. Instead, we’ll use Magento’s core models and helper classes.

Retrieving the Telephone Number for Templates

If you’re trying to output the store telephone in your template files (.phtml), you can achieve this using the Mage::getStoreConfig function provided by Magento. Here’s a simple example:

<?php echo Mage::getStoreConfig('general/store_information/phone'); ?>

This code will fetch and display the value from the database. You can place this anywhere in your template file where you need to display the store telephone number.

Retrieving the Telephone Number for CMS Pages

For displaying the telephone number in Magento’s CMS pages, you’ll use a similar approach but within a controller action:

public function indexAction()
{
    $telephone = Mage::getStoreConfig('general/store_information/phone');
    echo $telephone;
}

In this example, we’re fetching the store phone number within an indexAction method of a custom CMS page controller. The fetched value is then echoed onto the page.

Best Practices and Considerations

While these examples work, there are some best practices to keep in mind:

  1. Caching: Ensure you have proper caching set up for your static blocks or CMS pages to improve performance.

  2. Translations: If your store supports multiple languages, consider using Mage::helper('core')->__() to ensure the telephone number is translated correctly.

  3. Security: Never output sensitive data like phone numbers directly in your template files without proper checks and sanitization.

Conclusion

Retrieving the store contact telephone in Magento isn’t complex once you understand the core functions available. Whether you’re working with templates or CMS pages, using Mage::getStoreConfig provides a quick and efficient way to fetch this data from the configuration table.

Remember, for more advanced customizations or extensive data manipulation, consider exploring Magento’s Object Manager and other advanced APIs provided by Laravel Company here. Happy coding!

Let me know if you have any further questions or need additional guidance on this topic.

Database Performance Security Themes

Our network