Amy JB Clayton Posted December 7, 2011 Share Posted December 7, 2011 Is there anyway to display the customer comment that customers can add on the address page of the checkout procedure to the delivery pdf. I've managed to edit it so that the gift-wrapping message is shown, but am not sure of the variable that needs to be included so that the order message is shown. Any help would be much appreciated. Link to comment Share on other sites More sharing options...
Guest Posted January 6, 2012 Share Posted January 6, 2012 I would really need an answer to this also. Can anyone help? Link to comment Share on other sites More sharing options...
Guest Posted January 10, 2012 Share Posted January 10, 2012 Bump, Can anyone gives us the heads up on this? Link to comment Share on other sites More sharing options...
Guest Posted January 13, 2012 Share Posted January 13, 2012 Oh dear, I think i need a holiday I actually dreamt last night that someone had replied with an answer Link to comment Share on other sites More sharing options...
Amy JB Clayton Posted February 2, 2012 Author Share Posted February 2, 2012 Does any one have any idea how to do this - my client wants the message displayed on the delivery slip. Link to comment Share on other sites More sharing options...
Guest Posted February 2, 2012 Share Posted February 2, 2012 I managed this with the help of a module http://www.presta-addons.com/moduly/3-pdf-rozsireni.html The one draw back that I have not managed to sort out yet is that if the customer pays woth PayPal on Moneybookers, then the customer message also contains the transaction details Link to comment Share on other sites More sharing options...
patrikar Posted May 19, 2014 Share Posted May 19, 2014 (edited) This is how to to add customer comment message to the PDF invoice. Tested in 1.5.2. 1. Edit the file /override/classes/order/OrderInvoice.php.2. Copy the function getProducts() from /classes/order/OrderInvoice.php and paste it inside the class in the override file.3. In the override file, paste the following lines directly after the statement foreach ($products as $row) {. // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end 4. Edit the file /pdf/invoice.tpl. 5. Paste the following where you want the customer comment message to appear. NOTE! This has to be after the listing of products. (Because it utilizes a remaining variable from the product foreach loop.) {$order_detail.first_order_message} That's it! As a further example - here's my complete /override/classes/order/OrderInvoice.php: Note that the original function getProducts() can be vary between versions of Prestashop. My current version is 1.5.2. <?php class OrderInvoice extends OrderInvoiceCore { /** * Get order products * * @return array Products with price, quantity (with taxe and without) */ /* overridden to add order customer note to pdf invoice */ public function getProducts($products = false, $selectedProducts = false, $selectedQty = false) { if (!$products) $products = $this->getProductsDetail(); $order = new Order($this->id_order); $customized_datas = Product::getAllCustomizedDatas($order->id_cart); $resultArray = array(); foreach ($products as $row) { // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end // Change qty if selected if ($selectedQty) { $row['product_quantity'] = 0; foreach ($selectedProducts as $key => $id_product) if ($row['id_order_detail'] == $id_product) $row['product_quantity'] = (int)($selectedQty[$key]); if (!$row['product_quantity']) continue; } $this->setProductImageInformations($row); $this->setProductCurrentStock($row); $this->setProductCustomizedDatas($row, $customized_datas); // Add information for virtual product if ($row['download_hash'] && !empty($row['download_hash'])) { $row['filename'] = ProductDownload::getFilenameFromIdProduct((int)$row['product_id']); // Get the display filename $row['display_filename'] = ProductDownload::getFilenameFromFilename($row['filename']); } $row['id_address_delivery'] = $order->id_address_delivery; /* Stock product */ $resultArray[(int)$row['id_order_detail']] = $row; } if ($customized_datas) Product::addCustomizationPrice($resultArray, $customized_datas); return $resultArray; } } Edited May 19, 2014 by patrikar (see edit history) 3 Link to comment Share on other sites More sharing options...
cocodeluxe Posted June 3, 2014 Share Posted June 3, 2014 This is how to to add customer comment message to the PDF invoice. Tested in 1.5.2. 1. Edit the file /override/classes/order/OrderInvoice.php. 2. Copy the function getProducts() from /classes/order/OrderInvoice.php and paste it inside the class in the override file. 3. In the override file, paste the following lines directly after the statement foreach ($products as $row) {. // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end 4. Edit the file /pdf/invoice.tpl. 5. Paste the following where you want the customer comment message to appear. NOTE! This has to be after the listing of products. (Because it utilizes a remaining variable from the product foreach loop.) {$order_detail.first_order_message} That's it! As a further example - here's my complete /override/classes/order/OrderInvoice.php: Note that the original function getProducts() can be vary between versions of Prestashop. My current version is 1.5.2. <?php class OrderInvoice extends OrderInvoiceCore { /** * Get order products * * @return array Products with price, quantity (with taxe and without) */ /* overridden to add order customer note to pdf invoice */ public function getProducts($products = false, $selectedProducts = false, $selectedQty = false) { if (!$products) $products = $this->getProductsDetail(); $order = new Order($this->id_order); $customized_datas = Product::getAllCustomizedDatas($order->id_cart); $resultArray = array(); foreach ($products as $row) { // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end // Change qty if selected if ($selectedQty) { $row['product_quantity'] = 0; foreach ($selectedProducts as $key => $id_product) if ($row['id_order_detail'] == $id_product) $row['product_quantity'] = (int)($selectedQty[$key]); if (!$row['product_quantity']) continue; } $this->setProductImageInformations($row); $this->setProductCurrentStock($row); $this->setProductCustomizedDatas($row, $customized_datas); // Add information for virtual product if ($row['download_hash'] && !empty($row['download_hash'])) { $row['filename'] = ProductDownload::getFilenameFromIdProduct((int)$row['product_id']); // Get the display filename $row['display_filename'] = ProductDownload::getFilenameFromFilename($row['filename']); } $row['id_address_delivery'] = $order->id_address_delivery; /* Stock product */ $resultArray[(int)$row['id_order_detail']] = $row; } if ($customized_datas) Product::addCustomizationPrice($resultArray, $customized_datas); return $resultArray; } } How could I do to show it in the delivery-slip very thanks Link to comment Share on other sites More sharing options...
patrikar Posted June 4, 2014 Share Posted June 4, 2014 How could I do to show it in the delivery-slip very thanks In the same way as described earlier. But in step 5 use the following smarty variable instead: {$product.first_order_message} Because in delivery-slip.tpl, the product loop looks like this: {foreach $order_details as $product} compared to: {foreach $order_details as $order_detail} in invoice.tpl. Can you verify if this works? Link to comment Share on other sites More sharing options...
cocodeluxe Posted June 4, 2014 Share Posted June 4, 2014 In the same way as described earlier. But in step 5 use the following smarty variable instead: {$product.first_order_message} Because in delivery-slip.tpl, the product loop looks like this: {foreach $order_details as $product} compared to: {foreach $order_details as $order_detail} in invoice.tpl. Can you verify if this works? Works like a charm Any posibilitity show only no private messages like order generate by employe or payments methods confirmations? Thanks a lot Link to comment Share on other sites More sharing options...
patrikar Posted June 4, 2014 Share Posted June 4, 2014 Works like a charm Any posibilitity show only no private messages like order generate by employe or payments methods confirmations? Thanks a lot Sorry but I don't know anything about that. I suggest you look inside classes/order.php, maybe there is some options for getFirstMessage() or some other appropriate method. Link to comment Share on other sites More sharing options...
tuk66 Posted June 6, 2014 Share Posted June 6, 2014 I managed this with the help of a module http://www.presta-addons.com/moduly/3-pdf-rozsireni.html The one draw back that I have not managed to sort out yet is that if the customer pays woth PayPal on Moneybookers, then the customer message also contains the transaction details Here is a recipe - http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1677379 Link to comment Share on other sites More sharing options...
germinc Posted July 6, 2014 Share Posted July 6, 2014 (edited) What i posted previously breaks some other aspect of the site. Do not do this. Edited July 8, 2014 by germinc (see edit history) Link to comment Share on other sites More sharing options...
sersbjutien Posted October 12, 2014 Share Posted October 12, 2014 This is how to to add customer comment message to the PDF invoice. Tested in 1.5.2. 1. Edit the file /override/classes/order/OrderInvoice.php. 2. Copy the function getProducts() from /classes/order/OrderInvoice.php and paste it inside the class in the override file. 3. In the override file, paste the following lines directly after the statement foreach ($products as $row) {. // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end 4. Edit the file /pdf/invoice.tpl. 5. Paste the following where you want the customer comment message to appear. NOTE! This has to be after the listing of products. (Because it utilizes a remaining variable from the product foreach loop.) {$order_detail.first_order_message} That's it! As a further example - here's my complete /override/classes/order/OrderInvoice.php: Note that the original function getProducts() can be vary between versions of Prestashop. My current version is 1.5.2. <?php class OrderInvoice extends OrderInvoiceCore { /** * Get order products * * @return array Products with price, quantity (with taxe and without) */ /* overridden to add order customer note to pdf invoice */ public function getProducts($products = false, $selectedProducts = false, $selectedQty = false) { if (!$products) $products = $this->getProductsDetail(); $order = new Order($this->id_order); $customized_datas = Product::getAllCustomizedDatas($order->id_cart); $resultArray = array(); foreach ($products as $row) { // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end // Change qty if selected if ($selectedQty) { $row['product_quantity'] = 0; foreach ($selectedProducts as $key => $id_product) if ($row['id_order_detail'] == $id_product) $row['product_quantity'] = (int)($selectedQty[$key]); if (!$row['product_quantity']) continue; } $this->setProductImageInformations($row); $this->setProductCurrentStock($row); $this->setProductCustomizedDatas($row, $customized_datas); // Add information for virtual product if ($row['download_hash'] && !empty($row['download_hash'])) { $row['filename'] = ProductDownload::getFilenameFromIdProduct((int)$row['product_id']); // Get the display filename $row['display_filename'] = ProductDownload::getFilenameFromFilename($row['filename']); } $row['id_address_delivery'] = $order->id_address_delivery; /* Stock product */ $resultArray[(int)$row['id_order_detail']] = $row; } if ($customized_datas) Product::addCustomizationPrice($resultArray, $customized_datas); return $resultArray; } } Is there any way to display all order messages instead of just the first one? Link to comment Share on other sites More sharing options...
tuk66 Posted October 13, 2014 Share Posted October 13, 2014 Create a similar function and get all messages, instead of the first only. public static function getMessages($id_order) { $messages = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT `message` FROM `'._DB_PREFIX_.'message` WHERE `id_order` = '.(int)$id_order.' ORDER BY `id_message` '); return nl2br(implode("\n", (array)$messages)); } not tested 1 Link to comment Share on other sites More sharing options...
Kaper Posted July 20, 2015 Share Posted July 20, 2015 Please what about 1.6.1.0 ? Thanks Link to comment Share on other sites More sharing options...
karlitomadrid Posted October 1, 2015 Share Posted October 1, 2015 About 1.6.1.0 ? Thanks Link to comment Share on other sites More sharing options...
w3bsolutions Posted October 2, 2015 Share Posted October 2, 2015 (edited) Here is a little module I did for a client to show the note the customer leaves during checkout on the PDF Invoice on PS 1.6.1. Hope it is useful for anyone. Update 2016/11/08 New version of module: as requested by several users the order comment now shows on the delivery slip PDF too. To update, just download attachment and install module normally as any other module. Update 2016/11/15 Module is now available at http://addons.prestashop.com/en/24711-order-note-on-pdfs.html - all support will be given via the PS addons shop. Update 2016/11/18 Module is now compatible with PS 1.5 too. Kind regards.. Edited November 17, 2016 by fire2 (see edit history) 5 Link to comment Share on other sites More sharing options...
karlitomadrid Posted October 5, 2015 Share Posted October 5, 2015 Thanks!!!!! its work perfect!!! Link to comment Share on other sites More sharing options...
taydotech123 Posted October 5, 2015 Share Posted October 5, 2015 its work Link to comment Share on other sites More sharing options...
w3bsolutions Posted October 13, 2015 Share Posted October 13, 2015 Thanks!!!!! its work perfect!!! its work Glad I could help, if you have any idea to add please do ;-) Link to comment Share on other sites More sharing options...
CrossY Posted October 20, 2015 Share Posted October 20, 2015 This is how to to add customer comment message to the PDF invoice. Tested in 1.5.2. 1. Edit the file /override/classes/order/OrderInvoice.php. 2. Copy the function getProducts() from /classes/order/OrderInvoice.php and paste it inside the class in the override file. 3. In the override file, paste the following lines directly after the statement foreach ($products as $row) {. // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end 4. Edit the file /pdf/invoice.tpl. 5. Paste the following where you want the customer comment message to appear. NOTE! This has to be after the listing of products. (Because it utilizes a remaining variable from the product foreach loop.) {$order_detail.first_order_message} That's it! As a further example - here's my complete /override/classes/order/OrderInvoice.php: Note that the original function getProducts() can be vary between versions of Prestashop. My current version is 1.5.2. <?php class OrderInvoice extends OrderInvoiceCore { /** * Get order products * * @return array Products with price, quantity (with taxe and without) */ /* overridden to add order customer note to pdf invoice */ public function getProducts($products = false, $selectedProducts = false, $selectedQty = false) { if (!$products) $products = $this->getProductsDetail(); $order = new Order($this->id_order); $customized_datas = Product::getAllCustomizedDatas($order->id_cart); $resultArray = array(); foreach ($products as $row) { // hack start if( end($products) === $row ) { $row['first_order_message'] = nl2br($order->getFirstMessage()); } // hack end // Change qty if selected if ($selectedQty) { $row['product_quantity'] = 0; foreach ($selectedProducts as $key => $id_product) if ($row['id_order_detail'] == $id_product) $row['product_quantity'] = (int)($selectedQty[$key]); if (!$row['product_quantity']) continue; } $this->setProductImageInformations($row); $this->setProductCurrentStock($row); $this->setProductCustomizedDatas($row, $customized_datas); // Add information for virtual product if ($row['download_hash'] && !empty($row['download_hash'])) { $row['filename'] = ProductDownload::getFilenameFromIdProduct((int)$row['product_id']); // Get the display filename $row['display_filename'] = ProductDownload::getFilenameFromFilename($row['filename']); } $row['id_address_delivery'] = $order->id_address_delivery; /* Stock product */ $resultArray[(int)$row['id_order_detail']] = $row; } if ($customized_datas) Product::addCustomizationPrice($resultArray, $customized_datas); return $resultArray; } } Not sure if i'm missing anything, but this doesn't seem to work for 1.5.4. I'm not getting any errors, but it doesn't show in the invoice PDF. Force compile on, cache off. Link to comment Share on other sites More sharing options...
jaimeweb Posted December 11, 2015 Share Posted December 11, 2015 Can someone advise how to get this working with 1.5.4? thanks Link to comment Share on other sites More sharing options...
ang3lx Posted January 17, 2016 Share Posted January 17, 2016 (edited) Here is a little module I did for a client to show the note the customer leaves during checkout on the PDF Invoice on PS 1.6.1. Hope it is useful for anyone. Hello, module works like a charm with invoice. is possible to add to slip hook too? I need to have first order message on slip without modify prestashop core thanks in advance Edited January 17, 2016 by ang3lx (see edit history) Link to comment Share on other sites More sharing options...
decorocco Posted January 17, 2016 Share Posted January 17, 2016 @Fire2 Great to see there is a module for this! Is there anyway to adapt it to show the comments in the Delivery Slip? Thanks and best, Decorocco Link to comment Share on other sites More sharing options...
w3bsolutions Posted February 1, 2016 Share Posted February 1, 2016 @Fire2 Great to see there is a module for this! Is there anyway to adapt it to show the comments in the Delivery Slip? Thanks and best, Decorocco Hi, PS confirmed (http://forge.prestashop.com/browse/PSCSX-7533) they will add order note field on the default invoice template again in PS 1.6.1.5, I would wait to see if they add it to delivery slip too. Regards, Link to comment Share on other sites More sharing options...
Don Cappello Posted April 21, 2016 Share Posted April 21, 2016 (edited) Hallo all, i need to list note on slip now. The PS Version is 1.6.4 Is it possible? Thanks, Domenico Edited April 21, 2016 by Don Cappello (see edit history) Link to comment Share on other sites More sharing options...
lovemyseo Posted June 11, 2016 Share Posted June 11, 2016 HTMLTemplateDeliverySlip.phpWhat about delivery slip , in my case there is purchase order number on invoice but its not printing on delviery slip , I used purchase order module, and it uss a htmltemplateinvoice.php which is being copied override/classes/pdf folder which make PO to be copied on invoice but its not copying on delviery slip any idea attached is the file HTMLTemplateDeliverySlip.php Link to comment Share on other sites More sharing options...
lovemyseo Posted June 11, 2016 Share Posted June 11, 2016 Hi, PS confirmed (http://forge.prestashop.com/browse/PSCSX-7533) they will add order note field on the default invoice template again in PS 1.6.1.5, I would wait to see if they add it to delivery slip too. Regards, can you make a module to show message on delivery slip too? Link to comment Share on other sites More sharing options...
w3bsolutions Posted November 8, 2016 Share Posted November 8, 2016 (edited) @Fire2 Great to see there is a module for this! Is there anyway to adapt it to show the comments in the Delivery Slip? Thanks and best, Decorocco Edit: new version of the module is in my original post: https://www.prestashop.com/forums/topic/145386-adding-customer-comment-message-to-delivery-invoice-pdf/?p=2157392 Edited November 8, 2016 by fire2 (see edit history) Link to comment Share on other sites More sharing options...
Gabriele Posted October 29, 2017 Share Posted October 29, 2017 Hello. And what about if i want to show first comment of an order in order confirmation? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now