Jump to content

Add Product Location to Invoice


DKM84

Recommended Posts

Hello,

I've been looking into adding the product location to the invoice.
I added an extra row to the ps_order_detail in the database called product_location.

Then I changed:

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


to:

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


in classes/PDF.php

But I can't seem to find out where the ps_order_detail is being created. How do I put the location in product_location when the order is added to the database.
When I add a value to product_location manually with phpmyadmin it works fine and the location is visible on the invoice

Thanx in advance!

Link to comment
Share on other sites

Ok it works :D

in classes/PDF.php

if ($delivery)
   $this->SetX(25);
   if ($productQuantity)
   {
       // added following 2 lines
       $location1 = new Product((int)$product['product_id']);
       $location2 = $location1->location;

       $before = $this->GetY();
       ......




original

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


changed to:

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




I already changed the product reference to product id, so I couldn't use it for this.
original

$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? $product['product_reference'] : '--'), 'B');


changed to:

$this->Cell($w[++$i], $lineSize, ($product['product_id'] ? $product['product_id'] : '--'), 'B');




Had some trouble with the 'product_id' because the forum changes

''


to ''
Make sure to check the code when doing a copy and paste from the forum ;)

Thanks a lot!

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