0

I keep on getting an invalid callback error for my homemade Magento module. I'm using Magento 1.9.2.1 on an Ubuntu web server. My module is stored in: app/code/community/Foggyline/HappyHour/. The specific script is stored in: app/code/community/FoggyLine/HappyHour/Model/Observer.php

Config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Foggyline_HappyHour>
            <version>1.0.0.0</version>
        </Foggyline_HappyHour>
    </modules>

     <frontend>
         <routers>
            <foggyline_happyhour>
                <use>standard</use>
                <args>
                    <module>Foggyline_HappyHour</module>
                    <frontName>happyhour</frontName>
                </args>
            </foggyline_happyhour>
        </routers>
    </frontend>

    <crontab>
      <jobs>
        <happyhour_refresh_cache>
          <schedule><cron_expr>* * * * *</cron_expr></schedule>
          <run><model>happyHour/observer::refreshCache</model></run>
        </happyhour_refresh_cache>
      </jobs>
    </crontab>

</config>

Model/Oberserver.php :

<?php
/**
 * Checks for invalidated caches and refreshes them
 */
class Foggyline_HappyHour_Model_Observer {
    public static function refresh() {
      try {
        $allTypes = Mage::app()->useCache();
        foreach($allTypes as $type => $blah) {
          Mage::app()->getCacheInstance()->cleanType($type);
        }
      } catch (Exception $e) {
        // do something
        error_log($e->getMessage());
      }
    }}

Any thoughts on how to fix this?

0

Try adding a module tag to tell magento where to find the observer

 ...
 <models>
     <happyHour>
            <class>Foggyline_HappyHour_Model</class>
     </happyHour>
 <models>
 ...

or change

 <run><model>happyHour/observer::refreshCache</model></run>

To

 <run><model>Foggyline_HappyHour_Model_Observer::refreshCache</model></run>
|improve this answer|||||

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.