Jump to content

hookDisplayAdminProductsExtra in PS 1.5.0.1


endriudb

Recommended Posts

Hi all!

I'm working on a module and I use the hookDisplayAdminProductsExtra to show the module's control panel to users.

It's ok on the PS versions >= 1.5.4.0.

Today I was testing on the 1.5.0.1 version and I found that my custom tab is not showing at all in the list on the left.. I suppose my code is correct (with the newer versions it works).. maybe I need to use some particular way to implement the hookDisplayAdminProductsExtra in this PS version?

Thanks :D

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

can you show a part of hook funtion that you use?

also, do you see some errors ? hook you mentioned (and your module) appears on modules > positions section ?

 

Sorry for being late in answering, I returned in the office today :D

No, there are no errors and yes, the hook appears and it seems to be connected with my module.

Here is the code I use:

 

Constructor of the class

public function __construct()
{
	$this->name = 'roundview';
	$this->tab = 'front_office_features';
	$this->version = '1.7.5';
	$this->author = 'NORZ SRL';
	$this->need_instance = 0;
	$this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6');
	$this->bootstrap = true;
	$this->roundview_img_upload_path = _PS_IMG_DIR_.'roundview';

	parent::__construct();

	$this->displayName = $this->l('Roundview');
	$this->description = $this->l('Give your products a wonderful 360 view!');
	$this->confirmUninstall = $this->l('Are you sure you want to uninstall? The folder with all your -360 view- images will be deleted! Be sure to have a backup before proceeding.');
}

Registering the hook in the install method

public function install()
{
	if (Shop::isFeatureActive())
		Shop::setContext(Shop::CONTEXT_ALL);
		
	if (!parent::install()  ||
		!$this->registerHook('displayAdminProductsExtra') ||
		!$this->registerHook('displayRightColumnProduct') ||
		!$this->registerHook('displayHeader') ||
		!$this->registerHook('displayBackOfficeHeader') ||
	)
		return false;
	return true;
}

The hook's method

public function hookDisplayAdminProductsExtra($params)
{
	$id_product = (int)Tools::getValue('id_product');		
	if (Validate::isLoadedObject($product = new Product($id_product)))
	{
		$images = Db::getInstance()->ExecuteS('SELECT .....');
		$active = Db::getInstance()->ExecuteS('SELECT .....');
		$this->context->smarty->assign(array(
			'id_product' => $id_product,
			'roundview_images' => $images,
			'active' => (!empty($active[0]) ? $active[0]['active'] : false),
			'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__
		));
		return $this->display(__FILE__, 'views/templates/admin/RoundviewForm.tpl');
	}
}

All the other code is to uninstall the module or to handle other various hooks.

Is there something that doesn't work with the 1.5.0.1 PS version? :(

Link to comment
Share on other sites

  • 4 months later...

Hi!

I have the same problem. On 1.5.3.1 and above it works, but in 1.5.0.1 it is not visible under product tabs.

 

In Modules > Positions is listed on the bottom of the list with block header:

displayAdminProductsExtra - 1 module (Technical name: displayAdminProductsExtra)

 

My code is similar to endriudb's

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