Jump to content

[SOLVED] PHP Notice: Undefined variable: newProducts after uppgrade to 1.5.5


Recommended Posts

Hello, after installing the lastest ps, the displaying of new products on frontpage disappered.

 

If i click on new products label,  they all appear as before.

I tried resetting/disabling but no change.

 

the log gives  

apache2: PHP Notice:  Undefined variable: newProducts in /prestashop/modules/blocknewproducts/blocknewproducts.php on line 118

 
below is the function from the file.
 
Any ideas where to begin?
 
---
 
                        $this->smarty->assign(array(
                                'new_products' => $newProducts,
                                'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
                        ));

 

Link to comment
Share on other sites

HI,

 

I had the same error, so I just replaced the "public function hookRightColumn($params)" with the one from ps 1.5.4.1 (see below) and it worked ! ;)

public function hookRightColumn($params)
    {
        $newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR')));
        if (!$newProducts && !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
            return;

        $this->smarty->assign(array(
            'new_products' => $newProducts,
            'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
        ));

        return $this->display(__FILE__, 'blocknewproducts.tpl');
    }
  • Like 1
Link to comment
Share on other sites

 

HI,

 

I had the same error, so I just replaced the "public function hookRightColumn($params)" with the one from ps 1.5.4.1 (see below) and it worked ! ;)

public function hookRightColumn($params)
    {
        $newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR')));
        if (!$newProducts && !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
            return;

        $this->smarty->assign(array(
            'new_products' => $newProducts,
            'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
        ));

        return $this->display(__FILE__, 'blocknewproducts.tpl');
    }

Yes, it worked..

thanks.

Link to comment
Share on other sites

×
×
  • Create New...