Jump to content

Access product id in a module


Recommended Posts

Hello everybody,

 

i wrote a little module, which makes it easier to pick a certain color in an extra window (fancybox).

 

The module creates and displays a button via my files customcolorpick.php -> customcolorpick.tpl. The file customcolorpick.tpl in turn opens a dialog.php via fancybox where i need to access my current product id, from which the form was started.

 

This is my little code example:

 

customcolorpick.php

public function hookCustomHook($params)
{
	// Does not work
	$product = $this->context->controller->getProduct();
	

	$this->context->controller->addCSS($this->_path.'css/product.css', 'all');
	$this->context->smarty->assign(
	array(
		'module_color' => Configuration::get('MODUL_COLOR'),
		'module_window_link' => $this->context->link->getModuleLink('customcolorpick', 'display')
	)
	);
return $this->display(__FILE__, 'customcolorpick.tpl');
}

customcolorpick.tpl:

<a class="iframe" id="wishlist_button_nopop" href="{$module_window_link}">Farbton wählen</a>

Any ideas?

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