0
Welcome Guest! Login
0 items Join Now

custom feature init() method not firing

  • custom feature init() method not firing

    Posted 11 years 1 month ago
    • For some reason the init() method in my custom feature is not firing. The code can be found below.
      The strange thing is that this worked fine on my gantry template which i was using for the old website. We have recently migrated to a new template running on gantry 4 (paradigm) but for some reason the init() method is not firing. I tried echo-ing something in the isEnabled() method and that seemed to work, but the init() method is not being reached.

      Any ideas?


      <?php
      defined('JPATH_BASE') or die();
      
      gantry_import('core.gantryfeature');
      jimport('custom.ghost');
      jimport('joomla.environment.browser');
      
      class GantryFeatureWebshopRedirect extends GantryFeature {
      
          var $_feature_name = 'webshopredirect';
      
          function isEnabled() {
              return true;
          }
      
          function isInPosition($position) {
              return false;
          }
      
          function isOrderable() {
              return true;
          }
      
          function init() {
              global $gantry;
              //Redundancy check for Scanner
              $isHmi = stripos(JBrowser::getInstance()->getAgentString(), "AnkleScannerHmi");
      
              if ((JRequest::getVar('scanner') == 1 && !empty($_GET['email']))) {
                  $email = JRequest::getVar('email');
                  $userClass = new scannerUser;
                  $user = $userClass->userCheck($email);
                  $userClass->process($user);
              }
              if ($user->exists) {
                  JFactory::getSession()->set('scanner', 1);
                  header("Location: " . $gantry->getCurrentUrl . "/shop2/scanner-login?tmpl=shopindex&scanner=1&login=" . $email);
              } elseif ($isHmi) {
                  JFactory::getSession()->set('scanner', 1);
              } elseif (JRequest::getVar('tmpl') != 'shopindex' && (JRequest::getVar('scanner') == 1 || JFactory::getSession()->get('scanner') == 1 )) {
                  JFactory::getSession()->set('scanner', 1);
                  //header("Location: " . $gantry->getCurrentUrl . "?tmpl=shopindex");
              }
              if (JRequest::getVar('scanner') == '0') {
                  JFactory::getSession()->set('scanner', 0);
              }
          }
      
      }

Time to create page: 0.073 seconds