Error when switching them in TB1.07



  • Hi,

    I just tried to install a theme and got an error. Swtching on the debug mode gives following information.
    Same theme is working on 1.06 version.
    What is wrong?

    Warning: Declaration of Link::getImageLink($name, $ids, $type = NULL, $rollover = NULL) should be compatible with LinkCore::getImageLink($name, $ids, $type = NULL, $format = ‘jpg’, $highDpi = false) in /home/xxxxx/domains/xxx/public_html/shop/override/classes/Link.php on line 0
    [ThirtyBeesException]

    Too few arguments to function SmartyLazyRegister::register(), 1 passed in /home/xxx/domains/xxx/public_html/shop/modules/prestapassionsmartcodes/prestapassionsmartcodes.php on line 258 and exactly 3 expected
    at line 237 in file config/smarty.config.inc.php

    1. /**
      
    2.  * Register a function or method to be dynamically called later
      
    3.  * @param string|array $params function name or array(object name, method name)
      
    4.  */
      
    5. public function register($name, $type, $callable)
      
    6. {
      
    7.     $this->registry[$name] = [
      
    8.         'callable' => $callable,
      
    9.         'type' => $type
      
    10.     ];


  • @piet, please show the code from /modules/prestapassionsmartcodes/prestapassionsmartcodes.php around line 258 (+/- 10 lines)



  • @datakick

    Thanks for you fast reaction. Below the code.

    /* ------------------------------------------------------------- /
    /

    /* FRONT OFFICE RELATED STUFF
    /*
    /* ------------------------------------------------------------- */

    /* ------------------------------------------------------------- */
    /*  PREPARE FOR HOOK
    /* ------------------------------------------------------------- */
    
    private function _prepHook($params)
    {
        $this->context->smarty->assignGlobal('PRESTAPASSIONSMARTCODES_ENABLE', Configuration::get('PRESTAPASSIONSMARTCODES_ENABLE'));
    
        // Register prestapassionProcessSmartCodes smarty plugin
        $lazyRegister = SmartyLazyRegister::getInstance();
        $lazyRegister->register(array('prestapassionSmartCodesProcessor', 'prestapassionProcessSmartCodes'));
    
        $this->context->smarty->registerPlugin('function', 'prestapassionProcessSmartCodes', array($lazyRegister, 'prestapassionProcessSmartCodes'));
    }
    
    
    /* ------------------------------------------------------------- */
    /*  HOOK (displayFooterSocialLinks)
    /* ------------------------------------------------------------- */
    public function hookDisplayHeader($params)
    {
        $this->_prepHook($params);
    }
    

    }



  • @piet could you please modify config/smarty.config.inc.php, and change function register inside SmartyLazyRegister class to this (including function signature!):

        public function register($name, $type='function', $callable=null)
        {
            if (is_null($callable)) {
              if (is_array($name) && count($name) === 2) {
                $callable = $name;
                $name = $name[1];
              } else {
                throw new PrestaShopException("Invalid usage of SmartyLazyRegister::register");
              }
            }
            $this->registry[$name] = [
                'callable' => $callable,
                'type' => $type
            ];
        }
    
    


  • @datakick Modified your code and it works like it should. Thanks for your fast reply and the solution.

    @lesley This is exactly an example why people should switch to Thirty Bees 🙂 Me happy!



  • @piet thanks for confirmation, I’ll include this change to the 1.0.8. So don’t worry, you will be able to upgrade without any fears you will loose this change


 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.