Jump to content

[SOLVED] Product manufacturer on invoices


Recommended Posts

Hi there,

I would like to add the product manufacturers on the prestashop invoices.

In classes/PDF.php (line 438) I found :

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



I would like to do something like :

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



... but $product['manufacturer_name'] don't exist in this file.
If anyone know the good syntax...

Thanks for your help !
Bye

Link to comment
Share on other sites

Hmm probably something like:

$this->MultiCell($w[0], 5, Tools::iconv('utf-8', self::encoding(), Manufacturer::getNameById($product['id_manufacturer']).' '.$product['product_name']), 'B'); 



But I haven't really checked it out properly, so could well be wrong :)

Paul

Link to comment
Share on other sites

I've had a quick look at pdf.php, and the only reference I can see to the code you're quoting is in ProdReturnTab which is for product returns....

The function ProdTab looks more promising! (Although I'm looking at the 1.1 beta code, so the method may have changed)

You'll first need to modify $header and $w with the column names and column widths as appropriate.

In Order.php you'll need to modify the getProducts() member function to also fetch id_manufacturer for the product (it's not currently returned in the array).

Then you'll need to alter the ProdTab function to output the manufacturer name in the PDF document.

Not as trivial as it first appears!!

Paul

Link to comment
Share on other sites

OK. I solved the problem like this :

$fabricant = Db::getInstance()->ExecuteS(' SELECT id_manufacturer FROM `'._DB_PREFIX_.'product` WHERE `id_product` = '.intval($product['product_id']));
$this->MultiCell($w[0], 5, Tools::iconv('utf-8', self::encoding(), Manufacturer::getNameById($fabricant[0]['id_manufacturer']).' - '.$product['product_name']), 'B');

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

Is there anyone with a solution for 1.5? I cannot immagion that knowbody want to not display the manufacture name on the invoice. I think it is a pretty logical to have that. Both for yourseld (shop owner) and for the customer.

 

Thanks in advance!

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