Totti 59 Posted July 16, 2015 The new version of the module is immediately available at www.presta-addons.com. All upgrades are FREE for life. CHANGELOG v2.2.3 (2015-07-14) - Expanded price_breakdown data for credit slips, more information about compound taxes (for USA, Canada and other countries) - New template "Credit slips - compound taxes", showing the individual taxes - New data "Legal free text" for invoices - shop.invoice_legal_free_text (PrestaShop v1.6.1.0 and later) - All invoice templates show "Legal free text" below order items - Fixed doubled credit slip items (only if compound taxes are present) - Voucher is shown when both free shipping and another discount is used in one cart rule New version has this error : Fatal error: Can't use function return value in write context in /var/www/vhosts/xxxx.com/httpdocs/modules/m4pdf/m4pdf.php on line 2296 Quote Share this post Link to post Share on other sites
tuk66 774 Posted July 16, 2015 This is a bug (PHP < 5.5.0 only). Change code around the line 2296 if (!empty(trim($line))) in /modules/m4pdf/m4pdf.php to: foreach (preg_split("/((\r?\n)|(\r\n?))/", (string)Tools::getValue('includes')) as $line) { $line = trim($line); if (!empty($line)) $includes[] = $line; } Quote Share this post Link to post Share on other sites
tuk66 774 Posted July 16, 2015 The new version of the module is immediately available at www.presta-addons.com. All upgrades are FREE for life.CHANGELOG v2.2.4 (2015-07-16)- Fixed "Can't use function return value in write context in .../modules/m4pdf/m4pdf.php on line 2296" error 1 Quote Share this post Link to post Share on other sites
And63 45 Posted July 21, 2015 Look at the m4_catalog_sorted_category.tpl template, for example. You need to change the main loop from {section} to {foreach} and use "simpler" $product variable: {foreach from=$product|@sortby:"parents_categories_level" item=products name=cycle} {$products.name|escape:'htmlall':'UTF-8'} {/foreach} For you it is a simple matter, I tried many times and unfortunately not worked it out. Post #292 Can you help me? Quote Share this post Link to post Share on other sites
tuk66 774 Posted July 22, 2015 Sure, send me PM with your template and email address. I'll look at it. 1 Quote Share this post Link to post Share on other sites
And63 45 Posted July 23, 2015 (edited) tuk66 - thank you very much for your help - your solution is ideal. Edited July 25, 2015 by And63 (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted July 25, 2015 Here is the solution (products sorted by the default category ID): {foreach from=$product|@sortby:"id_category_default" item=products name=cycle} <table autosize="1" class="w100" style="page-break-inside:avoid"> {if $products.active >= 1} <tr> <td colspan=2 class="w100 name"> {$products.name|escape:'htmlall':'UTF-8'}<tocentry content="{$products.name|escape:'htmlall':'UTF-8'}" level="0" /> </td> </tr> <tr> <td width="20%"> {assign var="id_product_id_image" value="`$products.id_product`-`$products.image.id_image`"} <img class="photo" src="{if $products.image.id_image}{imageLink name=$products.link_rewrite ids=$id_product_id_image}{else}{$conf.pdf_iso_lang}.jpg{/if}" /> </td> <td> <br /> <div>{$products.description_short}</div> <p class="bigger"><br /><strong>{l s='Cena netto:' mod='m4pdf'} {displayPrice price=$products.price currency=$conf.currency_current}</strong><br /></p> </td> </tr> {/if} </table> {/foreach} Quote Share this post Link to post Share on other sites
mediabunker 1 Posted August 7, 2015 Hi, I have purchased your M4PDF module and I'm very pleased with the results so far. I have based my catalogue output on the 'm4_catalog.tpl' template but I have three questions: 1) On my TOC page, I'd like to group products by category. For example: Category 1 Product 1 Product 2 Category 2 Product 1 Product 2 ...etc. Is this possible? 2) When I have a product with a very long table of attributes/combinations, it scales the table down in size (very small) and also creates a blank page before the product page. Ideally, I'd like to break long tables over multiple pages (and with no blank page before them). I have looked at your various templates and even mPDF docs but have not found anything to solve these two issues. Hope you can help. Thanks, Adam. Quote Share this post Link to post Share on other sites
mediabunker 1 Posted August 7, 2015 Additionally to my comments above, a couple more questions: 1) How do I specify a single customer group (discounts) in a template and apply all the rules of that group to all prices shown in the outputted PDF catalogue (all product combinations)? 2) Can the quality/file size of the outputted PDF's be reduced, as they are quite large? Thanks, Adam. Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 12, 2015 Hi, I have purchased your M4PDF module and I'm very pleased with the results so far. I have based my catalogue output on the 'm4_catalog.tpl' template but I have three questions: 1) On my TOC page, I'd like to group products by category. For example: Category 1 Product 1 Product 2 Category 2 Product 1 Product 2 ...etc. Is this possible? 2) When I have a product with a very long table of attributes/combinations, it scales the table down in size (very small) and also creates a blank page before the product page. Ideally, I'd like to break long tables over multiple pages (and with no blank page before them). I have looked at your various templates and even mPDF docs but have not found anything to solve these two issues. Hope you can help. Thanks, Adam. 1) TOC I haven't try to do a complex table of contents. In general, the whole catalog have to be grouped by categories to group TOC by categories as well. Start with the "Catalog sorted by category organized in grid" template (m4_catalog_sorted_category.tpl). There are two TOC tags available: <tocpagebreak> (http://mpdf1.com/manual/index.php?tid=182) <tocentry> (http://mpdf1.com/manual/index.php?tid=119) 2) Tables See http://mpdf1.com/manual/index.php?tid=319 and http://mpdf1.com/manual/index.php?tid=77 for options. Escpecially these parts: prevent an individual table from resizing e.g. <table autosize="1"> <table style="page-break-inside:avoid"> to force the table onto one page. Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 12, 2015 Additionally to my comments above, a couple more questions: 1) How do I specify a single customer group (discounts) in a template and apply all the rules of that group to all prices shown in the outputted PDF catalogue (all product combinations)? 2) Can the quality/file size of the outputted PDF's be reduced, as they are quite large? Thanks, Adam. 1) Customer group prices An example is in the "Catalog with specific prices, filtered" template (m4_catalog_specific_prices.tpl). Define the groupFilter variable (an array of group IDs) at the top. 2) PDF size You probably mean a catalog with many images. I think it is about these images. You can use smaller images. Just define the type (depends on your store settings). : {imageLink type=medium_default ..... Quote Share this post Link to post Share on other sites
mediabunker 1 Posted August 12, 2015 (edited) 1) Customer group prices An example is in the "Catalog with specific prices, filtered" template (m4_catalog_specific_prices.tpl). Define the groupFilter variable (an array of group IDs) at the top. 2) PDF size You probably mean a catalog with many images. I think it is about these images. You can use smaller images. Just define the type (depends on your store settings). : {imageLink type=medium_default ..... Thanks for this - the image size selector worked great. However, I'm still having trouble with group ID's, even using the 'm4_catalog_specific_prices.tpl'. It seems that it only displays specific prices set within each product (I even checked the data output through the debug.tpl). For example, I have a group that gives 20% off all products in the store. I could hard code the 20% into the template, but I would preferably like to reference the group data itself. Additionally, I have another group that gives 20% of category A, 30% of category B etc... Any ideas? Thanks. Edited August 12, 2015 by mediabunker (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 12, 2015 Consider to calculate prices using the SpecificPrice::getSpecificPrice static method if you have complex price structure. Just be sure you have set all parameters as you need. I mean prices aren't fixed, but depend on customer group, country, currency and others. Quote Share this post Link to post Share on other sites
mediabunker 1 Posted August 12, 2015 Hi, Thanks for the tip - Could you provide an example of how this would work in a template, I'm not exactly sure how you would include this function within smarty code... or would I need to add it into M4_product.php somewhere? ...help very confused, any help would be appreciated. Thankyou. Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 12, 2015 A static method example is at https://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1668332 Quote Share this post Link to post Share on other sites
Plika1988 2 Posted September 8, 2015 Is it possible to get the total reduction amount from an order with this module? Not just the voucher discount total. Quote Share this post Link to post Share on other sites
tuk66 774 Posted September 8, 2015 Yes, it is. You have base prices for all order items and the total amount. The difference is the total discount. Quote Share this post Link to post Share on other sites
Plika1988 2 Posted September 8, 2015 Thats awesome. Just what I've been looking for. So then how would you get the total base price before discount then? Quote Share this post Link to post Share on other sites
tuk66 774 Posted September 8, 2015 (edited) Start with the m4_invoice_discount.tpl template, where $base_price and $base_price_wt variables are calculated for every order item, and sum them inside the loop. Something like: {assign var="total_base_price" value="`0`"} {section name=detail loop=$order[orders].order_detail} ... {assign var="total_base_price" value=$total_base_price+$base_price} ... {/section} Edited September 8, 2015 by tuk66 (see edit history) Quote Share this post Link to post Share on other sites
Plika1988 2 Posted September 8, 2015 Oke so I'm in the m4_invoice_discount.tpl template and I'm not sure where to put the code. Could you help me? and is this all i have to add or is there more to it? {assign var="total_base_price" value="`0`"} {section ...} {assign var="total_base_price" value=$total_base_price+$base_price} {/section} Sorry for al the questions. Not my strong point. Quote Share this post Link to post Share on other sites
tuk66 774 Posted September 8, 2015 OK. I changed the section tag to know more. Quote Share this post Link to post Share on other sites
Plika1988 2 Posted September 8, 2015 Thank you. that has got me a little further. I'm testing it on an order that has 3 different products. Each product has a different price. product 1 : € 7.00 product 2 : € 6.00 product 3 : € 5.25 Total : € 18.25 The problem I'm having now is that it is only adding up product 1 (€ 7.00 x 3). So it's displaying the total as € 21.00. What am I doing wrong? Quote Share this post Link to post Share on other sites
tuk66 774 Posted September 8, 2015 Yeah, $base_price is the price for one piece. You need to multiply it by $order[orders].order_detail[detail].product_quantity. 1 Quote Share this post Link to post Share on other sites
Plika1988 2 Posted September 8, 2015 Okey....I'm totally lost now. I'll just leave the total discount i think. Awesome module though. I love the fact that you can look up the variables easily. Thanks for your help and time. Quote Share this post Link to post Share on other sites
giuliopowa 120 Posted October 26, 2015 hello,i have a problem .for example , when a german costumer make a order in my site this is what is in the pdf (img 1)I want the PDF that I print of the back office is completely in Italian. For the description of the products I make in this way. (img 2)but the attribute does not change the language, is the language that the customer chooses to view the site. because I have the site in 4 languages: Italian, English, German, Slovenian.and for example, if a German customer chooses to view the site in German, the attribute will be in German. but I would like to be in Italian.thanks !! Quote Share this post Link to post Share on other sites
tuk66 774 Posted October 27, 2015 It is not so easy. The German part (left) is composed from the product name and all attributes and stored in the database just in customer's language. The Italian part is taken from the product itself (description) and this text will change in the invoice, when you change the product description itself. The German part can be taken from the product as well, but you need to deal with attributes and know that it can change as well. Quote Share this post Link to post Share on other sites
giuliopowa 120 Posted October 27, 2015 hello,but there is a way to solve this my problem ??thanks ! Quote Share this post Link to post Share on other sites
tuk66 774 Posted October 28, 2015 Using the Product::getProductName method is one approach. Quote Share this post Link to post Share on other sites
wbtitsing 0 Posted November 10, 2015 I run version 2.2.4 on prestashop 1.6.0.14 I setup the "package send" status to include an invoice. 2 problems here: 1 pdf is in wrong language 2 pdf states "no order" at the beginning of the pdf However when I make an testorder myself and set the status to "package send" I get a correct invoice. I can also clearly see in Amazon that the pdf files are wrong because I can see what messages are sent. Any ideas? Quote Share this post Link to post Share on other sites
tuk66 774 Posted November 12, 2015 @wbtitsing 1. What do you mean "wrong language"? 2. Where is the PDF created (Orders, module administration, Front Office). Do you mean "no orders"? Quote Share this post Link to post Share on other sites
wbtitsing 0 Posted November 15, 2015 (edited) 1 The invoice created should have the customers language, however the pdf created has the standard language of the shop. 2 I do not know where and when the actual is created but I can tell you where I set it so be created/ send In the tab Statuses you can edit the many statuses. The standard status shipped has a checkbox for: Attach invoice PDF to email I checked that box. The PDF created says "no orders" I think when the language is different from the standard language. Hopefully it is clear what I mean. Edited November 15, 2015 by wbtitsing (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted November 16, 2015 Sorry, it did not help at all. Please contact me at www.presta-addons.com. I will immediately set your module to work properly. Quote Share this post Link to post Share on other sites
socket84 0 Posted November 19, 2015 Hi all, i've bought the module, how can edit the invoice template m4_invoice_2_nonzero.tpl to show the DNI in PDF? The client also add the DNI in his account, but when i make the invoice a can't see the DNI. Prestasho version 1.6.0.11 Module version 2.2.4 Let me know, thanks! Quote Share this post Link to post Share on other sites
tuk66 774 Posted November 19, 2015 The DNI field is in the ps_address table, so you can show it these ways:{if $order[orders].address_delivery.dni}{$order[orders].address_delivery.dni|escape:'htmlall':'UTF-8'}{/if}or{if $order[orders].address_invoice.dni}{$order[orders].address_invoice.dni|escape:'htmlall':'UTF-8'}{/if}As of client's DNI, do you mean she added it to the contact details, as Registration? If yes, this value is already shown in the footer, using this snippet:if $order[orders].shop.shop_details}{$order[orders].shop.shop_details|escape:'htmlall':'UTF-8'}{/if} Quote Share this post Link to post Share on other sites
JenL 2 Posted December 7, 2015 Hello, I have a question. You customized an invoice for me since I have a lot of customers in Norway and need a lot of details on the invoices because of customs. Now I had a Black Friday sale with 20% discount and free shipping.Inoticed that the discount and the free shipping doesn't show up on my customized invoices.Can this be fixed ?I also have free shipping once the order goes over 1000 SEK, that also doesn't show up on the invoice.But I need this detailed on the invoices because norwegian customs wants to know the shipping costs all the time. Best regards, Jennifer Quote Share this post Link to post Share on other sites
tuk66 774 Posted December 7, 2015 Can you send me the customized template as well as some real examples (@ email or PM)? There is no problem to improve it. Quote Share this post Link to post Share on other sites
Totti 59 Posted January 5, 2016 This module is not compatible with new function of PS ? Quote Share this post Link to post Share on other sites
tuk66 774 Posted January 5, 2016 You mean these options: Add current year to invoice number Reset Invoice progressive number at beginning of the year Only the first is important (the second is managed directly in the database). You can imitate this setting in some template using these snippets: PREFIX {$order[orders].shop.invoice_prefix} INVOICE NUMBER {$order[orders].invoice_number|string_format:"%06d"} YEAR of order {$order[orders].date_add|date_format:"%Y"} YEAR of invoice {$order[orders].invoice_date|date_format:"%Y"} 1 Quote Share this post Link to post Share on other sites
smaagraa 0 Posted January 19, 2016 (edited) Tuk: Thanks for your last answer concerning the snippet to show the product names in the back office language. Let me know if the following is possible to be done with this module: I need to print every day a summary of orders (name & address of buyer and items buyed) to be prepared at the warehouse. At this point, I am printing every single delivery slip and I would like to have them all together in a single document. The point is: 1. Can I select multiple orders and print an extract of those orders in a single document? 2. Can I print a number of orders that have a certain status? Thanks in advance. Jorge Edited January 19, 2016 by smaagraa (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted January 20, 2016 There is the "Order items list" template which can be easily adapted to print the summary as you described. 1, 2 You can filter out orders by dates from-to, order status and more and print the summary in one document. More select options will come in a next version. Stay tuned. 1 Quote Share this post Link to post Share on other sites
smaagraa 0 Posted January 26, 2016 Tuk: I finally got to work the template in which I get a summary of the orders filtered. The only problem now is the page break between sections in loop. I do not get to work the page-break-inside property in the template. Is this a browser problem? How can I get the template not to cut the sections or divs when they reach the end of the page? Thanks in advance. Jorge. Quote Share this post Link to post Share on other sites
tuk66 774 Posted January 27, 2016 In page layout templates, page breaks are done by this style: {if !$smarty.section.orders.first}document{$smarty.section.orders.index}{/if} Just remove it. You can add a page break as <pagebreak /> Quote Share this post Link to post Share on other sites
haylau 197 Posted March 2, 2016 (edited) Hi Really not sure if this is to do with prestashop, m4pdf or another module altogether We have a purchase order payment module. The customer types in a purchase order number, and the module creates a customer message with the order number. All works fine, I can see the message in the back office and I can see the message on our M4PDF template invoice. BUT the order confirmation email which has the invoice attached does not show the message So, first of all settings. You can see here I am using the same template Customer creates an order and we can see here the purchase order number is in the message area Invoice from back office (and in customer account) shows customer message: Invoice emailed to customer as part of the order confirmation email shows message is missing You can see both invoice are the same m4pdf template, just the emailed one does not have the customer message, Any ideas ?? Is there a reason prestashop / m4pdf would send a slightly altered invoice? Edited March 2, 2016 by haylau (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted March 6, 2016 That message is stored in the database by a 3rd party module and it probably becomes after sending the order confirmation email. Quote Share this post Link to post Share on other sites
ritopina 25 Posted March 17, 2016 Hi, PDF module is it seo friendly in product page. If the pdf module generates a sheet, google can consider the pdf and the product page as duplicate. and PDF button on the product page it is nofollow Your module interests me, but I fear the dupliacte, can you confirm to me that there is no problem with google. Best regard Quote Share this post Link to post Share on other sites
tuk66 774 Posted March 18, 2016 There is no problem with Google, because the PDF catalog is generated by JavaScript and downloaded dynamically in a hidden iframe. I mean, there is no real <a> element which links to the PDF document. Quote Share this post Link to post Share on other sites
ritopina 25 Posted March 18, 2016 This is good news for seo Thank Quote Share this post Link to post Share on other sites
tuk66 774 Posted March 19, 2016 Sample custom catalog for Italian wine seller http://www.presta-addons.com/pdf/Custom%20catalog%20for%20meteri.it.pdf Quote Share this post Link to post Share on other sites
haylau 197 Posted April 8, 2016 Hi We are using module version 2.2.2 with prestashop 1.6.1.3 and "Invoice with message from a customer" The code for the customer message is: <!-- start order message block --> {if $order[orders].message.message} <div class="clear">{l s='Customer\'s message:' mod='m4pdf'}</div> <div class="clear">{$order[orders].message.message|escape:'htmlall':'UTF-8'}</div> {/if} <!-- end order message block --> The problem we have is that there is often more than one customer message (for example our quote module will add the quote number as a message, the customer might leave their own message and the payment system also adds a message) Now what happens is that each message is put on a new page rather than a new line. So, one customer with one order is getting a three page invoice. Each page contains the full invoice details plus one of the messages Anyway to join all these messages so they appear on the same page? Quote Share this post Link to post Share on other sites
tuk66 774 Posted April 8, 2016 It looks like unexpected use of the ps_message table by the module. Can you send me PM with data from the ps_message table? Quote Share this post Link to post Share on other sites
tuk66 774 Posted April 12, 2016 Some modules use messages in their own way, so I prepared a fix for the next version (2.3.0). Send me PM if you need it right now. 2 Quote Share this post Link to post Share on other sites
planetediscount 5 Posted April 23, 2016 Hello, I find a problem after updating to prestashop 1.6.1.4. And for fist time credit slip in Prestashop in good but in M4 PDF 2.2.4 it is wrong. (with have done the commit (https://github.com/PrestaShop/PrestaShop/commit/f42c45fcb69fe445dadd344ee260c612cef4909e) for good shipping tax on credit slip, so this is also good on M4 PDF I have with prestashop credit slip : (that is good) Products : - 5,99 € - 30,00 € - 26,90 € Shipping tax inlc - 13,99 € Total Products tax inlc- 62,89 € Total Tax - 12,81 € Total tax incl - 76,88 € Tax detail 20.000 % Products - 10,48 € shipping - 2,33 € But on M4 PDF 2.2.4 with credit slip or Credit slips - compound taxes i have : Products: - 5,99 € - 30,00 € - 26,90 € Shipping tax inlc - 13,99 € Total Products tax inlc- 52,41 € -- WRONG should be 62.89 € --- 52.41 € is the total products price BUT without tax. Total Tax - 11,06 € Total tax incl - 66,40 € Tax detail 20.000 % Products - 8,73 € shipping - 2,33 € On Prestashop 1.6.0.14 it was working fine, but on Prestashop 1.6.1.4 it does this. Really strange. Thanks for help Quote Share this post Link to post Share on other sites
planetediscount 5 Posted April 23, 2016 I maybe find why this error : On the table "order_slip" on database with have the column "amount" where on Prestashop 1.6.0.14 the total product with tax was filled in. BUT now with Prestashop 1.6.1.4 it is filled with total product without tax so in this case 52.41€. I think your template then use this column amount where prestashop credit slip don't use it. How can we change this ? Regards, Quote Share this post Link to post Share on other sites
tuk66 774 Posted April 23, 2016 Thanks for the very detailed description. In fact, PrestaShop is like flowing sands. One version is right, another is wrong, we prepare a fix, and so on, and so on. This is why this module came into being. Overcome problems in a simple manner. I will properly test it within next days and find the best solution. Quote Share this post Link to post Share on other sites
planetediscount 5 Posted April 23, 2016 Hello Tuk66, I think i found solution, Prestashop is so poor, really i may think to change solution as they really don't care, don't test, and don't even change when commit on Forge are making it better. This problem is on all prestashop 1.6.1.x and EVEN on Prestashop 1.7, really stupid. We have to change (yes again) one line in orderslip.php (for other with shipping tax wrong on credit slip is commit see post #354) See the commit here : https://github.com/PrestaShop/PrestaShop/pull/3174 I have tested and now all is ok i may continu some testing to be sure. I'm also really surprise that nobody else came here to talk about this ? does merchant just don't use credit slip or don't do legal credit slip ? Quote Share this post Link to post Share on other sites
tuk66 774 Posted April 23, 2016 Sometimes someone causes an error when modifying code. I have seen it many times, but almost no tests is simply a wrong way. That commit is 10 months old! Quote Share this post Link to post Share on other sites
planetediscount 5 Posted April 23, 2016 Yes like you say Tuk66 the commit is 10 months old, but xBorderie instead of make test as prefered to say to guzru to make the commit again on branch 1.6.1, i found this so amazing. Look like we have to make they job... Quote Share this post Link to post Share on other sites
Mao9000 3 Posted May 3, 2016 looking for a little help. I am working with catalog template, Catalog grouped by default categories, all data. I would like to add a second image to each product. ie position 2 image. here is a like to see what I am wanting to achieve. https://goo.gl/photos/ES3wDD4UhxdBsKjL8 I want position 2 image to show under the main product image. I know I need to modify the below code. I have tried but can not find the correct code that allows the additional image. thanks in advance. --- <td width="20%"> {assign var="id_product_id_image" value="`$products.id_product`-`$products.image.id_image`"} <img class="photo" src="{if $products.image.id_image}{imageLink name=$products.link_rewrite ids=$id_product_id_image force_protocol=$force_protocol}{else}{$conf.img_prod_dir}{$conf.pdf_iso_lang}.jpg{/if}" /> </td> --- Quote Share this post Link to post Share on other sites
tuk66 774 Posted May 4, 2016 Try to adapt this recipe: https://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-9?do=findComment&comment=1807308 and replace <td width="20%"> {assign var="id_product_id_image" value="`$products.id_product`-`$products.image.id_image`"} <img class="photo" src="{if $products.image.id_image}{imageLink name=$products.link_rewrite ids=$id_product_id_image force_protocol=$force_protocol}{else}{$conf.img_prod_dir}{$conf.pdf_iso_lang}.jpg{/if}" /> </td> with <td width="20%"> {factory assign="product" class="Product" id_product=$products.id_product id_lang=$m4_actual_language} {if is_object($product)} {assign var="images" value=$product->getImages($m4_actual_language)} {assign var="i" value=0} {section name=image loop=$images} {if $images[image].id_image && $i < 2} {assign var="id_product_id_image" value="`$products.id_product`-`$images[image].id_image`"} {if $products.image.id_image}<img class="photo" src="{imageLink name=$products.link_rewrite ids=$id_product_id_image force_protocol=$force_protocol}" />{/if} {assign var="i" value="`$i+1`"} {/if} {/section} {/if} </td> 1 Quote Share this post Link to post Share on other sites
Mao9000 3 Posted May 4, 2016 That worked Try to adapt this recipe: https://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-9?do=findComment&comment=1807308 and replace <td width="20%"> {assign var="id_product_id_image" value="`$products.id_product`-`$products.image.id_image`"} <img class="photo" src="{if $products.image.id_image}{imageLink name=$products.link_rewrite ids=$id_product_id_image force_protocol=$force_protocol}{else}{$conf.img_prod_dir}{$conf.pdf_iso_lang}.jpg{/if}" /> </td> with <td width="20%"> {factory assign="product" class="Product" id_product=$products.id_product id_lang=$m4_actual_language} {if is_object($product)} {assign var="images" value=$product->getImages($m4_actual_language)} {assign var="i" value=0} {section name=image loop=$images} {if $images[image].id_image && $i < 2} {assign var="id_product_id_image" value="`$products.id_product`-`$images[image].id_image`"} {if $products.image.id_image}<img class="photo" src="{imageLink name=$products.link_rewrite ids=$id_product_id_image force_protocol=$force_protocol}" />{/if} {assign var="i" value="`$i+1`"} {/if} {/section} {/if} </td> That worked like a Charm.. thanks Quote Share this post Link to post Share on other sites
admin974 1 Posted May 8, 2016 (edited) Hello, how to add stock management in m4pdf tpl : available_date or available_later or available_now or in stock or out of stock please Thanks Edited May 8, 2016 by admin974 (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted May 9, 2016 You can get the available_date value using: {$order[orders].order_detail[detail].product.available_date} or {dateFormatLanguage date=$order[orders].order_detail[detail].product.available_date full=0} Quote Share this post Link to post Share on other sites
jon19797 0 Posted June 16, 2016 Hello, First, fantastic module! Next, we are using invoice with details, what I need to add is the email address of the customer onto the invoice, under telephone number of invoice/shipping details. I can't figure out the code to do this though? Can you help? Many thanks! Quote Share this post Link to post Share on other sites
tuk66 774 Posted June 17, 2016 Use {$order[orders].customer.email|escape:'htmlall':'UTF-8'} to show the customer's email address. Quote Share this post Link to post Share on other sites
ccw0103 5 Posted June 20, 2016 Hello, the invoice generated has different total amount, I think it is due to rounding problem, any way to set/solve? Quote Share this post Link to post Share on other sites
tuk66 774 Posted June 20, 2016 Can you clarify your issue? The settings, the real database data as well as a PDF example are helpful. Quote Share this post Link to post Share on other sites
Ubicacion 0 Posted June 22, 2016 Hello how do I make the PDF include the page number in the footer? Im workin in prestashop 1.6.1.5 and with the template DELIVERYSLIP with images. Also, I would like to include a QR code with the location of the page of the product ¿any idea? thanks Quote Share this post Link to post Share on other sites
tuk66 774 Posted June 24, 2016 (edited) @ page number Add <div class="align-right">{l s='P.' mod='m4pdf'} {literal}{PAGENO} / {nbpg}{/literal}</div> below the line <htmlpagefooter name="footer{$smarty.section.orders.index}"> @ product page QR code Try <barcode code="{$link->getProductLink($order[orders].order_detail[detail].product_id)}" size="0.8" type="QR" error="M" class="barcode" /> inside the order items loop. Edited June 24, 2016 by tuk66 (see edit history) Quote Share this post Link to post Share on other sites
Ubicacion 0 Posted June 28, 2016 GREAT!!!!!!!! THANKS Quote Share this post Link to post Share on other sites
Ubicacion 0 Posted June 30, 2016 Hello How can I change the original delivery slip with the modified in the module, in the back office when I click on the button it generates the correct deliveyslip but the email that is sent keeps the old one. Any suggestion? reagrds, Quote Share this post Link to post Share on other sites
tuk66 774 Posted June 30, 2016 The email is sent with the invoice, not the delivery slip. See Payment Module > Invoice via email on the Settings tab. Quote Share this post Link to post Share on other sites
Ubicacion 0 Posted June 30, 2016 Hello Correct, I made all pdf look like the delivery (I do not need invoices) The module is perfectly integrated right now thanks for the help. regards, Quote Share this post Link to post Share on other sites
tuk66 774 Posted July 19, 2016 (edited) Font problem after updating Adobe Reader DC Edit: Version 2.2.5 contains the fixed fonts and no additional action is needed. Edit 2: There is a hotfix patch for Adobe DC and Adobe Reader DC at https://helpx.adobe.com/acrobat/release-note/acrobat-dc-july-21-2016.html. Some accented characters are not displayed (like á, š, ž, ż, ł, å, ä) and we can see this error (or similar): Cannot extract the embedded font MPDFAA++DejaVuSansCondensed some characters may not display or print correctly Affected versions are Adobe Reader DC 15.007.*, 15.017.*. Older Acrobat Reader versions works fine as well as 3rd party PDF readers. The latest versions seem to be more stringent on PDF specifications than the previous.How to fix it:- remove all files beginning with DejaVu from the /modules/m4pdf/libraries/mpdf/ttfonts directory- remove all files beginning with dejavu from the /modules/m4pdf/libraries/mpdf/ttfontdata directory- download fixed fonts at http://www.presta-addons.com/download498845689/m4pdf_fonts_2.3.zip and unzip them to the /modules/m4pdf/libraries/mpdf/ttfonts directory How to fix your own fonts:Use the "Type light" font editor - just open the TTF font file and save it. Edited August 1, 2016 by tuk66 (see edit history) 1 Quote Share this post Link to post Share on other sites
Ubicacion 0 Posted July 20, 2016 Hello I need a module that allows the client to select the employee mail who is going to manage the order and some other mails as well. Any suggestion? We are using Prestashop as a inner company shop. regards, Quote Share this post Link to post Share on other sites
tuk66 774 Posted July 21, 2016 The new version of the module is immediately available at www.presta-addons.com. All upgrades are FREE for life.CHANGELOG v2.2.5 (2016-07-21)- Fixed font problem after updating Adobe Reader DC (some accented characters are not displayed) Read the upgrade instructions in UPGRADE.TXT first- Added links to the Changelog and Upgrade Instructions on the Help tab Quote Share this post Link to post Share on other sites
smaagraa 0 Posted August 20, 2016 (edited) Hi again, Tuk66. I need to use a different field to filter "orders with detail" in the controller. Instead of invoice_date, I need to use delivery_date. Where can I change it? Now I am filtering within the template but this only allows me to filter the orders within the day (see below) and not the orders in a determinate range of dates. {if $order[orders].delivery_date|date_format:"%d/%m/%Y" == $smarty.now|date_format:"%d/%m/%Y"} ... {/if} If there was an option to point at the filtering range of the controller from within the template, this could also solve this issue. Thanks in advance. Jordi Keys: filter, date, template, controller, orders, detail Edited August 20, 2016 by smaagraa (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 23, 2016 (edited) Add this snippet in the /modules/m4pdf/M4Order.php file: 'delivery_date' => array('title' => $this->l('Delivery date'), 'widthColumn' => 65, 'width' => 65, 'align' => 'right', 'type' => 'date', 'filter_key' => 'a!delivery_date'), to $this->fields_display just before closing ); and also this one in the /modules/m4pdf/M4Object.php, the preProcess function, below the line: "$filter == 'invoice_date' ||" $filter == 'delivery_date' || Edited August 24, 2016 by tuk66 (see edit history) 1 Quote Share this post Link to post Share on other sites
smaagraa 0 Posted August 23, 2016 (edited) Add this snippet in the /modules/m4pdf/M4Order.php file: 'delivery_date' => array('title' => $this->l('Delivery date'), 'widthColumn' => 65, 'width' => 65, 'align' => 'right', 'type' => 'date', 'filter_key' => 'a!delivery_date'), to $this->fields_display just before closing ); Thanks for your prompt answer, Vlad. I tried it but it does not filter anything when entering date ranges. I have tried emptying cache and recompiling, but no luck. PS version is 1.6.1.2. Module version is 2.2.4 Edited August 23, 2016 by smaagraa (see edit history) Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 24, 2016 Sorry, one more change is needed. I have edited my original post. 1 Quote Share this post Link to post Share on other sites
smaagraa 0 Posted August 24, 2016 Dear Turek: Now it works perfectly. Thanks for your support. Jorge Quote Share this post Link to post Share on other sites
Timerider 2 Posted August 29, 2016 Hi, I need to include the Order Number in my invoices & delivery slips eg. "Order 123 Invoice 88.PDF" This is because I send invoices and delivery notes to my warehouse but when they have a question they reference the filename (invoice123.pdf or deliveryslip103.pdf), but I cannot quickly find the relevant order in prestashop without opening the PDF as there is no way to quickly list orders by invoice number in prestashop. I would need to enter an OrderNumber placeholder in the file name field - is this possible? Thanks a lot! Quote Share this post Link to post Share on other sites
obiwan8472 0 Posted August 30, 2016 Hi, encoutering a strange issue which I'm not sure if its related to Hosting, or the module? Bit of advice. When I try to create a Invoice with a message, for more than 20 orders at one time, this then creates a 404 Error. If its less than 20 orders, then the PDF creates fine and I get all my invoices. Any more than 20, I have to split them. Any ideas what it could be or if it is to do with my hosting company, what to ask them to do? Thanks Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 30, 2016 (edited) Hi, I need to include the Order Number in my invoices & delivery slips eg. "Order 123 Invoice 88.PDF" This is because I send invoices and delivery notes to my warehouse but when they have a question they reference the filename (invoice123.pdf or deliveryslip103.pdf), but I cannot quickly find the relevant order in prestashop without opening the PDF as there is no way to quickly list orders by invoice number in prestashop. I would need to enter an OrderNumber placeholder in the file name field - is this possible? Thanks a lot! The invoice number is shown at the Orders with details tab in the module administration. I wouldn't recommend to patch the invoice filename numbering, because of problems with upgrades. Hi, encoutering a strange issue which I'm not sure if its related to Hosting, or the module? Bit of advice. When I try to create a Invoice with a message, for more than 20 orders at one time, this then creates a 404 Error. If its less than 20 orders, then the PDF creates fine and I get all my invoices. Any more than 20, I have to split them. Any ideas what it could be or if it is to do with my hosting company, what to ask them to do? What Memory limit and Max execution time do you see at Advanced Parameters > Configuration Information? I think it can be low timeout related issue. Edited August 30, 2016 by tuk66 (see edit history) 1 Quote Share this post Link to post Share on other sites
obiwan8472 0 Posted August 30, 2016 What Memory limit and Max execution time do you see at Advanced Parameters > Configuration Information? I think it can be low timeout related issue. Hi, thanks for your reply. Its Memory limit 256M Max execution time 30 Quote Share this post Link to post Share on other sites
tuk66 774 Posted August 31, 2016 (edited) It would be unusual if 30 seconds is not enough to create 20 invoices. Anyway, I think this could be the reason. Is your server slow or fast? What URL? Edited August 31, 2016 by tuk66 (see edit history) Quote Share this post Link to post Share on other sites
obiwan8472 0 Posted August 31, 2016 It would be unusual if 30 seconds is not enough to create 20 invoices. Anyway, I think this is the reason? Is your server slow or fast? What URL? Hi, URL for the website? www.supapets-online.co.uk or did you want the admin panel or hosting website? Quote Share this post Link to post Share on other sites