Jump to content

[Tutorial] Add extra Manufacturer Information Tab on Product Page


Recommended Posts

Hello,

       I had to add an extra tab with manufacturer name,short description,description and "All products from this manufacturer" link to the product page as it was requested from my client and I'm sharing what I did to you guys.

 

Add thos code in the file ProductController.php in /controllers/front/ :

$id_lang = $this->context->language->id; $manufacturer = new Manufacturer($this->product->id_manufacturer, $id_lang); $manuf_description = $manufacturer->description;  $this->context->smarty->assign('manufact_desc', $manuf_description);
$id_lang = $this->context->language->id; $manufacturer = new Manufacturer($this->product->id_manufacturer, $id_lang); $manuf_name = $manufacturer->name;  $this->context->smarty->assign('manufact_name', $manuf_name);
$id_lang = $this->context->language->id; $manufacturer = new Manufacturer($this->product->id_manufacturer, $id_lang); $manuf_shortdesc = $manufacturer->short_description;  $this->context->smarty->assign('manufact_shortdesc', $manuf_shortdesc);

Add it just above:

$this->context->smarty->assign(array(
'pictures' => $pictures,
'textFields' => $text_fields));

Then add the following code to the product.tpl file in your theme directory(/themes/themename/):

<li><a id="more_info_tab_more_info" href="#idTab3">Manufacturer</a></li>

Add it above:

{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}

And finally add this code to the same file product.tpl:

<ul id="idTab3" class="rte">
<h3>{$manufact_name}{$manufact_shortdesc}</h3> 
<p>{$manufact_desc}<a href="{$link->getmanufacturerLink($product->id_manufacturer, $product->link_rewrite)}">View all products from {$product->manufacturer_name|escape:'htmlall':'UTF-8'}</a></p>
</ul>

Add it above:

{if isset($attachments) && $attachments}
<ul id="idTab9" class="bullet">

I attached the image of this tweak.

 

Ciao!

post-516311-0-87438900-1393600454_thumb.jpg

Edited by carpealexdiem (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

HI, thanks You for tutorial. But if i make changes in the ProductController.php, front office shop is blank :-(

Where is problem, please? Thanks You for reply :)

Prestashop version: 1.5.4

You should enable debug in prestashop:

 

go to config > defines.inc.php change the line:

define('_PS_MODE_DEV_', false);

to

define('_PS_MODE_DEV_', true);

and let me know what it says. :D

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 3 weeks later...
  • 2 months later...
  • 1 month later...
  • 4 weeks later...

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