Jump to content

[SOLVED]homeslider another position


Recommended Posts

Hi all, i have this little problem.

 

I crate a new hook http://www.prestashop.com/forums/topic/2182[spam-filter]create-custom-and-new-hook-in-ps-15/

 

I transplate home slider module in this hook.

In homeslider.php i have this

public function hookdisplayTop2($params) {
		$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());
		return $this->hookhome($params, 'displayTop2');		
	}

It works but this module is in two positions look http://zahradny.simplydesign.sk/index.php

 

When i unhook module from home, then disappear completely.

Edited by tozi (see edit history)
Link to comment
Share on other sites

I have 1.5.6.1.

 

I have two return because when i delete eg. return $this->display(__FILE__, 'homeslider.tpl', $this->getCacheId());

then home slider disappears.

 

This is my question. How to be right? Look to page yet. I unhook from home. Slider disappeared completely.

Edited by tozi (see edit history)
Link to comment
Share on other sites

use one return without caching

$this->display(__FILE__, 'homeslider.tpl');

and unhook module from displayHome hook.

 

+ make sure that your new hook is correctly implemented to your theme with {hook::exec('yournewhook')}

where you added it?

Link to comment
Share on other sites

Blank page.

 

I added this

public function hookdisplayTop2($params) {
		$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->hookhome($params, 'displayTop2');		
	}

I created a hook in accordance this tutorial. http://www.prestashop.com/forums/topic/2182[spam-filter]create-custom-and-new-hook-in-ps-15/

 

When i need display module i added this

{hook h='displayTop2'}

Link to comment
Share on other sites

Ok so i have a solution.

	public function hookdisplayTop2(){
	if(!$this->_prepareHook())
	return;
 
	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

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...