Jump to content

Transplant natives modules to new created hooks ?


Recommended Posts

Hello :)

 

I created a custom theme, in prestashop 1.6.0.9, and I add two new hooks in it.

 

My new hooks works fine, but I have a problem on an important point.

I can't transplant any natives modules in them, only modules I created or I modified to include the two new hooks work fine for transplantation.

 

So it's a way to do that, without core modification ?

 

Thanks for your help.

Link to comment
Share on other sites

To be sure we speak about the same thing, that's into a prestashop 1.6.0.9, and my hooks works fine with my custom themes and customs modules

 

But, if I don't add thoses lines, the module won't be transplanted.

 

Exemple with the blockcart module, with thoses lines that's ok, but without no

	public function install()
	{
		if (
			parent::install() == false
//			|| $this->registerHook('top') == false
			|| $this->registerHook('header') == false
			|| $this->registerHook('actionCartListOverride') == false
/* Thoses line are needed to be able to use the hook */
			|| $this->registerHook('displayTopLeft') == false
			|| $this->registerHook('displayTopRight') == false
/* FIN */
			|| Configuration::updateValue('PS_BLOCK_CART_AJAX', 1) == false
			|| Configuration::updateValue('PS_BLOCK_CART_XSELL_LIMIT', 12) == false
			|| Configuration::updateValue('PS_BLOCK_CART_SHOW_CROSSSELLING', 1) == false)
			return false;
		return true;
	}

and a bit more down :

	public function hookDisplayTopLeft($params)
	{
		$params['blockcart_top'] = true;
		return $this->hookTop($params);
	}

	public function hookDisplayTopRight($params)
	{
		$params['blockcart_top'] = true;
		return $this->hookTop($params);
	}

The error code say "This module can't be transplant on this hook"

Link to comment
Share on other sites

I think you'll need to override the native modules to allow them to be added to your custom hooks. For example, create override/modules/blockcart/blockcart.php with the following:



<?php

class BlockCartOverride extends BlockCart
{
public function hookDisplayTopLeft($params)
{
$params['blockcart_top'] = true;
return $this->hookTop($params);
}
}

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