Jump to content
tuk66

[MODULE] M4 PDF Extensions (with online editor)

Recommended Posts

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

Share this post


Link to post
Share on other sites

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;
}

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

 

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?

Share this post


Link to post
Share on other sites

Sure, send me PM with your template and email address. I'll look at it.

  • Like 1

Share this post


Link to post
Share on other sites

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}

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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:

 

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by mediabunker (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Is it possible to get the total reduction amount from an order with this module? Not just the voucher discount total.

Share this post


Link to post
Share on other sites

Yes, it is. You have base prices for all order items and the total amount. The difference is the total discount.

Share this post


Link to post
Share on other sites

Thats awesome. Just what I've been looking for. So then how would you get the total base price before discount then?

Share this post


Link to post
Share on other sites

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 by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Yeah, $base_price is the price for one piece. You need to multiply it by $order[orders].order_detail[detail].product_quantity.

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

 

post-721668-0-40801400-1445853040_thumb.png

post-721668-0-36908700-1445853042_thumb.jpg

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

@wbtitsing

 

1. What do you mean "wrong language"?

2. Where is the PDF created (Orders, module administration, Front Office). Do you mean "no orders"?

Share this post


Link to post
Share on other sites

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.

post-1082751-0-39422900-1447580174_thumb.jpg

Edited by wbtitsing (see edit history)

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

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}

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Can you send me the customized template as well as some real examples (@ email or PM)? There is no problem to improve it.

Share this post


Link to post
Share on other sites

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"}

 

  • Like 1

Share this post


Link to post
Share on other sites

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 by smaagraa (see edit history)

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

 

 

 

post-246958-0-67022900-1456924286_thumb.jpg

 

 

post-246958-0-48522100-1456924110_thumb.jpg

 

 

Customer creates an order and we can see here the purchase order number is in the message area

 

post-246958-0-39382500-1456924341_thumb.jpg

Invoice from back office (and in customer account) shows customer message:

 

post-246958-0-37707300-1456923568_thumb.jpg

 

Invoice emailed to customer as part of the order confirmation email shows message is missing

 

post-246958-0-48475000-1456923437_thumb.jpg

 

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 by haylau (see edit history)

Share this post


Link to post
Share on other sites

That message is stored in the database by a 3rd party module and it probably becomes after sending the order confirmation email.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

  • Like 2

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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.
 

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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>
  • Like 1

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

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 by admin974 (see edit history)

Share this post


Link to post
Share on other sites

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}

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Use

{$order[orders].customer.email|escape:'htmlall':'UTF-8'}

to show the customer's email address.

Share this post


Link to post
Share on other sites

Hello, 

 

the invoice generated has different total amount, I think it is due to rounding problem, any way to set/solve?

Share this post


Link to post
Share on other sites

Can you clarify your issue? The settings, the real database data as well as a PDF example are helpful.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@ 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 by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

The email is sent with the invoice, not the delivery slip. See Payment Module > Invoice via email on the Settings tab.

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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.

post-92842-0-89910200-1468945993_thumb.png

Edited by tuk66 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by smaagraa (see edit history)

Share this post


Link to post
Share on other sites

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 by tuk66 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

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 by smaagraa (see edit history)

Share this post


Link to post
Share on other sites

Sorry, one more change is needed. I have edited my original post.

  • Like 1

Share this post


Link to post
Share on other sites

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!

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by tuk66 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

 

 

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

Share this post


Link to post
Share on other sites

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 by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites