I'm am using the addLink method of Mage_Page_Block_Template_Links in my local.xml, which uses links.phtml as a template.

Is there some way of passing links.phtml the store email/phone addresses which I would normally get from from Mage::getStoreConfig('general/store_information/phone')?

I.e. something like:

<reference name="top.links">
        <action method="addLink">
                <url>tel:<?php echo Mage::getStoreConfig('general/store_information/phone') ?></url>

Thank you!

  • you could use a helper... <url helper="name/of/helper" />
    – roman204
    May 6 '14 at 8:42
  • ya I guess I'm wondering which one :-)
    – blisstdev
    May 6 '14 at 15:05
  • I thinke there is no predefined you should write a module
    – roman204
    May 6 '14 at 17:13
  • that's what I was afraid of...new to Magento and while there are a bunch of tutorials out there for making modules I'm overwhelmed
    – blisstdev
    May 6 '14 at 18:13

You need to add the following to your local.xml or your module's layout xml file.

    <reference name="top.links">
        <action method="addLink" translate="label title" module="your_module"><label>Phone</label><url helper="your_module/getSiteTelephone"/><title>Phone</title></action>

This will in the end call your helper Your_Module_Helper_Data->getSiteTelephone. In your helper you can then use the following code.

public function getSiteTelephone() {
    return 'tel:' . Mage::getStoreConfig('general/store_information/phone');

Sadly there is no helper that already does what you need but if you have a module already then it is very simply to add a function into your helper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.