Jump to content

[Solved] Add the Manufacturer Name on the Invoices


Recommended Posts

Hi,

I already posted my question on this topic: http://www.prestashop.com/forums/viewthread/7366/#296712
But as it is marked "Solved", I don't think anybody will look at it.

I tried the solution explained in that post but it didn't work.

I just want to get the Manufacturer Name before the Product Name in the table of the invoice.
It is quite important for my project as Manufacturer are "Restaurants".

Thank you in advance for your help!!

Link to comment
Share on other sites

Try changing line 575 of classes/PDF.php (in PrestaShop v1.3.1) from:

global $ecotax;



to:

global $ecotax, $cookie;



then change line 643 from:

$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']).' - '.self::l('Customized'), 'B');



to:

$productObj = new Product($product['product_id'], true, intval($cookie->id_lang));
$manufacturer_name = '';
$manufacturer = new Manufacturer($productObj->id_manufacturer, intval($cookie->id_lang));
if (Validate::isLoadedObject($manufacturer))
  $manufacturer_name = $manufacturer->name . ' ';
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $manufacturer_name.$product['product_name']).' - '.self::l('Customized'), 'B');



and line 666 (after the above change) from:

$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B');



to:

$productObj = new Product($product['product_id'], true, intval($cookie->id_lang));
$manufacturer_name = '';
$manufacturer = new Manufacturer($productObj->id_manufacturer, intval($cookie_id_lang));
if (Validate::isLoadedObject($manufacturer))
   $manufacturer_name = $manufacturer->name . ' ';
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $manufacturer_name.$product['product_name']), 'B');



This should add the manufacturer name in front of the product name.

Link to comment
Share on other sites

Thanks a million for the answer.

I replaced the codes in both areas but when nothing changed on the PDF. I still only have the Product Name.

Did you test it?

I am sorry... I am not good enough in php/smarty to see if there is a problem in you code...
Maybe something need be called from the database?

Thank you

Link to comment
Share on other sites

I've updated my code above. Please try again. It turns out I only modified the customised products and not the non-customised products. It should change both of them now. I can't test it though, since I don't have any manufacturers on my test site at the moment.

Link to comment
Share on other sites

  • 1 year 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...