Is it possible to call a function within the header.phtml file?

I have created essentially an on/off switch that will either enable or disable a button that I created on the front end. This button allows the user to open up a dialog box where they can search for stores closest to them and also log in.

The problem I am having is that when I make the call to check whether or not the back end module is enabled or disabled, magento will throw this error:

Invalid method Mage_Page_Block_Html_Header::enableFutureOrder(Array

enableFutureOrder is my custom function to check whether or not the module is enabled.

Here's the function itself:

class Namespace_Futureorder_Block_Container extends Mage_Core_Block_Template
    private $currentWorkloadLevel;
    private $currentTimeStamp;
    private $timeToOrder;
    private $timeSource;
    private $moduleEnabled;
    private $enableDisable;
    private $enableFutureOrder;
    private $storeAvailability;
    private $pickupTimes;
    private $deliveryTimes;
    private $numberOfPickupAndDeliveryDays;
    private $deliveryCollection;
    private $pickupCollection;

public function __construct()
        $this->enableDisable = Mage::getStoreConfig('enable_store/options/active');
        $this->enableFutureOrder = Mage::getStoreConfig('place_future_order/options/active');
        $this->currentTimeStamp = Mage::app()->getLocale()->storeTimeStamp(Mage::app()->getStore()->getStoreId());
        $this->currentWorkloadLevel = Mage::getModel('futureorder/Workload',$this->getCurrentTimeStamp())->getWorkloadLevel();
        $this->timeToOrder = Mage::getModel('futureorder/OrderTime', $this->getCurrentWorkloadLevel());
        $this->timeSource = Mage::getModel('futureorder/Config_Source_Time');
        $this->storeAvailability = Mage::getModel('futureorder/StoreAvailability');
        $this->moduleEnabled = Mage::getStoreConfig('futureorder_general/options/active');
        $this->pickup = false;
        $this->delivery = false;
        $this->numberOfPickupAndDeliveryDays = 14;
        $this->deliveryCollection = Mage::getModel('futureorder/DeliveryTimeCollection');
        $this->pickupCollection = Mage::getModel('futureorder/ShippingTimeCollection');

  public function enableFutureOrder()
        return $this->enableFutureOrder;

There is more to this class obviously with what is in the constructor, but not necessary to show the functionality.

So when I call this function within different places, it will work, but it will not work within the header.phtml file. Is there something I am forgetting to do to get this to work, or is it just not possible to call functions like this in the header file?

1 Answer 1


using below code at header.phtml file

$p=$this->getLayout()->createBlock('futureorder/container ');


$p->enableDisable;  //give the enableDisable  value
  • you are welcome..
    – Amit Bera
    Nov 10, 2014 at 15:19

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .