Jump to content

add js to header of mobile theme


Y Talansky

Recommended Posts

Sorry I'm a newbie but I'm trying to get the hang of it..

I can't figure out what I'm doing wrong can someone give me some pointers

I'm trying to convert the home slider for use with the mobile theme in the default theme

 

I'm up to getting the js and css into the header and added the following but doesn't seem to work?

Any pointers would be appreciated.

 

Thanks

if (parent::install() && $this->registerHook('displayMobileTopSiteMap') && $this->registerHook('displayMobileHeader') && $this->registerHook('actionShopDataDuplication'))

public function hookdisplayMobileTopSiteMap()
{
if(!$this->_prepareHook())
return;
 
// Check if not a mobile theme
if ($this->context->getMobileDevice() != true)
return false;
return $this->display(__FILE__, 'mobileslider.tpl', $this->getCacheId());
}
 
public function hookdisplayMobileHeader($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/mobileslider.js');
}
public function clearCache()
{
$this->_clearCache('mobileslider.tpl');
}
 
public function hookActionShopDataDuplication($params)
{
Db::getInstance()->execute('
INSERT IGNORE INTO '._DB_PREFIX_.'mobileslider (id_mobileslider_slides, id_shop)
SELECT id_mobileslider_slides, '.(int)$params['new_id_shop'].'
FROM '._DB_PREFIX_.'mobileslider
WHERE id_shop = '.(int)$params['old_id_shop']);
$this->clearCache();
}

I attached all the files where they are currently holding if anyone cares to take a look at it.

 

mobileslider.zip

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