Jump to content

get product information from categories page


Instituto IFIC

Recommended Posts

Hello,

 

I'm still a newbie in Prestashop development so I would really appreciate some help with an issue I'm facing.

 

I'm using a module that adds a button with a popup contact form in the product page, so that the user can ask for more information. This module gets the product's information (title, url..) plus the user's data from the form and sends an email to the administrator. (example http://www.ific.es/curso-online-de-coaching-personal)

 

I would like to add this button in the product-list.tpl as well, let's say here http://www.ific.es/cursos-online replacing the add to cart button.

 

So far, I've managed to add the button, open the popup and send the email BUT only with the user's data. I need to add each product's information as well in the email.

 

This is the hook that the original module used in order to get the product's information:

public function hookDisplayRightColumnProduct	{
		$product = $this->context->controller->getProduct(); 
		$image = Product::getCover((int)Tools::getValue('id_product'));
		$cover_image = $this->context->link->getImageLink($product->link_rewrite, $image['id_image'], 'medium_default');
		$phone = '';

		$this->context->smarty->assign(array(
			'logged' => $this->context->customer->isLogged(true),
			'product' => $product,
			'customer_company' => ($this->context->customer->company ? $this->context->customer->company : ''),
			'customer_email' => ($this->context->customer->email ? $this->context->customer->email : ''),
			'customer_phone' => $phone,
			'productmessage_cover_image' => $cover_image,
			'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
			'controller' => 'index.php?fc=module&module=contactcategories&controller=contact&ajax&action=contactform'
		));
		return $this->display(__FILE__, 'contactcategories.tpl');
	
	}

But this doesn't work when it comes to my modified module. I suppose there is a different way to get the product's data than this $product = $this->context->controller->getProduct(); ?

 

Any help would be great! I hope I've explained myself clearly, if not please ask for clarifications.

 

Thanks!!

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