Jump to content

[SOLVED] getCacheId() error in homeslider module


Recommended Posts

i did nothing when i visited the website i saw the blank page then i changed the error reporting from the config folder and i get this error. Fatal error: Call to undefined method HomeSlider::getCacheId() in /home4/surfcoas/public_html/modules/homeslider/homeslider.php on line 630

Link to comment
Share on other sites

ok, so you've got some issue with cache there.

what to do?

if i were you I will remove cache code from module .php file: homefeatured.php (from module directory)

 

instead of:

public function hookDisplayHome($params)
	{
		if (!$this->isCached('homefeatured.tpl', $this->getCacheId('homefeatured')))
		{
			$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
			$nb = (int)Configuration::get('HOME_FEATURED_NBR');
			$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));

			$this->smarty->assign(array(
				'products' => $products,
				'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
				'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			));
		}
		return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId('homefeatured'));
	}

just use this one:

	public function hookDisplayHome($params)
	{
		
			$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
			$nb = (int)Configuration::get('HOME_FEATURED_NBR');
			$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));

			$this->smarty->assign(array(
				'products' => $products,
				'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
				'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			));
		return $this->display(__FILE__, 'homefeatured.tpl');
	}
Link to comment
Share on other sites

ohh my bad, sry, do the same just for homeslider module:

(so sorry it was my mistake, very similar module names)

 

open homeslider.php (from module directory)

 

instead of:

	private function _prepareHook()
	{
		if (!$this->isCached('homeslider.tpl', $this->getCacheId()))
		{
			$slider = array(
				'width' => Configuration::get('HOMESLIDER_WIDTH'),
				'height' => Configuration::get('HOMESLIDER_HEIGHT'),
				'speed' => Configuration::get('HOMESLIDER_SPEED'),
				'pause' => Configuration::get('HOMESLIDER_PAUSE'),
				'loop' => Configuration::get('HOMESLIDER_LOOP'),
			);

			$slides = $this->getSlides(true);
			if (!$slides)
				return false;

			$this->smarty->assign('homeslider_slides', $slides);
			$this->smarty->assign('homeslider', $slider);
		}

		return true;
	}

use this one:

	private function _prepareHook()
	{
			$slider = array(
				'width' => Configuration::get('HOMESLIDER_WIDTH'),
				'height' => Configuration::get('HOMESLIDER_HEIGHT'),
				'speed' => Configuration::get('HOMESLIDER_SPEED'),
				'pause' => Configuration::get('HOMESLIDER_PAUSE'),
				'loop' => Configuration::get('HOMESLIDER_LOOP'),
			);

			$slides = $this->getSlides(true);
			if (!$slides)
				return false;

			$this->smarty->assign('homeslider_slides', $slides);
			$this->smarty->assign('homeslider', $slider);

		return true;
	}

and instead of:

	public function hookDisplayHome()
	{
		if(!$this->_prepareHook())
			return;

		// Check if not a mobile theme
		if ($this->context->getMobileDevice() != false)
			return false;

		$this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
		$this->context->controller->addCSS($this->_path.'bx_styles.css');
		$this->context->controller->addJS($this->_path.'js/homeslider.js');
		return $this->display(__FILE__, 'homeslider.tpl', $this->getCacheId());
	}

use this one:

	public function hookDisplayHome()
	{
		if(!$this->_prepareHook())
			return;

		// Check if not a mobile theme
		if ($this->context->getMobileDevice() != false)
			return false;

		$this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
		$this->context->controller->addCSS($this->_path.'bx_styles.css');
		$this->context->controller->addJS($this->_path.'js/homeslider.js');
		return $this->display(__FILE__, 'homeslider.tpl');
	}
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...