Jump to content
tuk66

[MODULE] M4 PDF Extensions (with online editor)

Recommended Posts

HOW TO show product features in invoice

 

Insert the code below inside the order_detail loop ({section name=detail loop=$order[orders].order_detail}) to display product features. This example shows using static functions inside a template.

{assign var="features" value=Product::getFrontFeaturesStatic($conf.pdf_id_lang, $order[orders].order_detail[detail].product_id)}
{* {$features|@debug_print_var} *}
{section name=feature loop=$features}
    {* use the first or second style *}
    {$features[feature].value}{if !$smarty.section.feature.last} x {/if}
    {* {$features[feature].name}: {$features[feature].value}{if !$smarty.section.feature.last}, {/if} *}
{/section}

.
To display only one feature use (set your feature name instead of Fill_in_name_of_feature string):

{assign var="features" value=Product::getFrontFeaturesStatic($conf.pdf_id_lang, $order[orders].order_detail[detail].product_id)}
{section name=feature loop=$features}
    {if $features[feature].name == 'Fill_in_name_of_feature'}
        {$features[feature].value|escape:'htmlall':'UTF-8'}
    {/if}
{/section}
Edited by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

Hello Vladimir,

 

I want to add messages of the order into the invoice, but it only shows me the private messages.

 

I tried to edit the M4Order.php, to LEFT JOIN the messages table by id_order not id_cart,

and in the TPL i tried several things, but i am unable to find the right smarty variables.

 

This part i want to edit to show normal messages, not the ones marked as private!

    <!-- start private messages block -->
    {if $order[orders].order_private_message}
        <div class="clear">{l s='Messages:' mod='m4pdf'}</div>
        {section name=private_message loop=$order[orders].order_private_message}
            <div class="clear">{$order[orders].order_private_message[private_message].message|escape:'htmlall':'UTF-8'}</div>
        {/section}
    {/if}
    <!-- end private messages block -->

Just so you know, I put the original m4order.php back as it was!

 

Thank you,

 

Jaivy

Share this post


Link to post
Share on other sites

HOW TO show messages in invoice

 

All messages are already available in data. No need to patch the module.

 

 

example from m4_invoice.tpl

<!-- start private messages block -->
{if $order[orders].order_private_message}
    <div class="clear">{l s='Messages:' mod='m4pdf'}</div>
    {section name=private_message loop=$order[orders].order_private_message}
        <div class="clear">{$order[orders].order_private_message[private_message].message|escape:'htmlall':'UTF-8'}</div>
    {/section}
{/if}
<!-- end private messages block -->

.

<!-- start public messages block -->
{if $order[orders].order_public_message}
    <div class="clear">{l s='Messages:' mod='m4pdf'}</div>
    {section name=public_message loop=$order[orders].order_public_message}
        <div class="clear">{$order[orders].order_public_message[public_message].message|escape:'htmlall':'UTF-8'}</div>
    {/section}
{/if}
<!-- end public messages block -->

.

example from m4_invoice_order_message.tpl

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

.

Invoice note

<!-- start invoice note block -->
{factory assign="order_object" class="Order" id=$order[orders].id_order}
{if is_object($order_object)}
    {assign var="note" value=$order_object->getInvoicesCollection()->getFirst()->note}
    {if (!empty($note))}
        <div class="clear">
            {l s='Note:' mod='m4pdf'}
            <br />
            {$note|escape:'htmlall':'UTF-8'|nl2br}
        </div>
    {/if}
{/if}
<!-- end invoice note block -->

.

Customer's messages

<!-- start customer messages block (PrestaShop v1.4 and later) -->
{if $order[orders].customer_message}
    <div class="clear">{l s='Customer\'s messages:' mod='m4pdf'}</div>
    {section name=index loop=$order[orders].customer_message}
        <div class="clear">{$order[orders].customer_message[index].message|escape:'htmlall':'UTF-8'}</div>
    {/section}
{/if}
<!-- end customer messages block -->

.

Private customer's messages

<!-- start private customer messages block (PrestaShop v1.4 and later) -->
{if $order[orders].customer_message}
    <div class="clear">{l s='Private customer\'s messages:' mod='m4pdf'}</div>
    {section name=index loop=$order[orders].customer_message}
        {if $order[orders].customer_message[index].private}
            <div class="clear">{$order[orders].customer_message[index].message|escape:'htmlall':'UTF-8'}</div>
        {/if}
    {/section}
{/if}
<!-- end customer messages block -->
Edited by tuk66 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hey Vladimir,

 

I will try the suggestion on the order messages as soon as i update the module!

Thank you for the help! :D

 

New update on M4PDF, when prestashop says this, the ability to configure the module is gone! Does this mean i am forced to update or is this just a problem?

linkscrn.png

 

m4scrn.png

I will update, but i really would like to decide for myself:)

Thank you!

 

Jaivy

Share this post


Link to post
Share on other sites

Jaivy, I really don't know. I mentioned on the forum that nobody should update this module using the "Update!" button because of unpredictable result. Upgrade instructions are in the UPGRADE.TXT file. See the /modules/m4pdf folder.

Share this post


Link to post
Share on other sites

Vladimir, i never said anything about using the update button, but when this is available, the configuration option is gone! That is the problem right now, i will use the UPGRADE.txt instructions to update the module.

Share this post


Link to post
Share on other sites

HOW TO disable the "Update it!" option in List of modules

 

The "Update it!" button has definitely wrong behavior! When the "Update it!" option is active I can disable the module. But has no change to enable it back. Also I cannot configure the module without updating.

 

Here is a dirty workaround.

 

1. Open the /your_admin_folder/themes/default/template/controllers/modules/list.tpl file

2. Locate 'Update it!' string around line 112

3. Add 0 && after {if in {if isset($module->version_addons) && $module->version_addons} 2 rows up

 

The code will look like this:

{if 0 && isset($module->version_addons) && $module->version_addons}
    <a class="btn btn-warning" href="{$module->options.update_url}">
        <i class="icon-refresh"></i> {l s='Update it!'}
    </a>

Share this post


Link to post
Share on other sites
Hello, 

 

I need help using the variables from the test template. Can you give me examples how to use them? Especially for "id_tax_rules_group"

 

Thanks

Share this post


Link to post
Share on other sites

You probably mean how to use variables shown in the debug template.

 

Put this code somewhere inside the order_detail loop {section name=detail loop=$order[orders].order_detail}

{$order[orders].order_detail[detail].product.id_tax_rules_group}

to display the group.

post-92842-0-40256300-1400828813_thumb.jpg

Share this post


Link to post
Share on other sites
Crap, I was so close to it :-) 

Thank you for the quick reply, it works perfectly! 

 

Another question, if I put a text behind the product name 

{$ order [orders] Order_Detail [detail] product_name | escape:.. 'htmlall': 'UTF-8'} 

then I have between the two is always a space. Where does that come from? 

 

--

If I need a query where I check if one of the products on the invoice a certain value in the id_tax_rules_group has to then display a text. How would I do this best? 

 

Do I have a new variable within 

  {section name = detail loop = $ order [orders]. Order_Detail 

assign a value} if id_tax_rules_group has the desired value?

--

Edit: 

 

Loop, Check value, then

{assign var="test" value="1"}

 

if query, check {if $diff_tax == 1}  it works yeah {else} {if}

 

I love M4PDF :)
Edited by xMartin (see edit history)

Share this post


Link to post
Share on other sites

Do it on the same row, not two rows. I suppose you have no extra space at the end of the product name.

{$order[orders].order_detail[detail].product_name|escape:'htmlall':'UTF-8'}{l s='a text' mod='m4pdf'}

A condition for id_tax_rules_group values:

{assign var="rules_group" value="`{$order[orders].order_detail[detail].product.id_tax_rules_group}`"}
{if $rules_group == 1}
    ... do something
{elseif $rules_group == 2}
    ... do something
{else}
    ... do the rest
{/if}
  • Like 1

Share this post


Link to post
Share on other sites
Woohoo, everything works! Perfect! 

 

Tip: If the Footer impact on the header, try it with a div clear ...

Edited by xMartin (see edit history)

Share this post


Link to post
Share on other sites

Another thing: I now generated a great template and am very satisfied. The bills are up 20 articles, only one page long. But if I create multiple invoices together in a PDF file, then overlap the sides.

Share this post


Link to post
Share on other sites

Big SORRY!

 

Some idiot forgot the following code and thereby ruined everything. now it works again.  :)

{section name=orders loop=$order}
    {if !$smarty.section.orders.first}
        @page document{$smarty.section.orders.index} {literal}[spam-filter]/literal}
            odd-footer-name: html_footer{$smarty.section.orders.index};
            even-footer-name: html_footer{$smarty.section.orders.index};
        {literal[spam-filter]{/literal}
        @page document{$smarty.section.orders.index} :first {literal}[spam-filter]/literal}
            resetpagenum: 1;
        {literal[spam-filter]{/literal}
        div.document{$smarty.section.orders.index} {literal}[spam-filter]/literal}
            page: document{$smarty.section.orders.index};
        {literal[spam-filter]{/literal}
    {/if}
{/section}
Edited by xMartin (see edit history)

Share this post


Link to post
Share on other sites

hello Vladimir, a small question.

I noticed that in the invoices, the company name comes below the persons name. WHile in the delivery note the company name is on top (which it should). How can I change this? When I look at the code it looks simulair to the deliver note.

 

    <div class="right w45 zero bigger">
        <p> </p>
        <p> </p>
        <p><strong>{l s='Invoice To' mod='m4pdf'}</strong><br />
        <div class="border" style="padding: 3mm; ">

        {if $order[orders].formatted_address_invoice}
            {$order[orders].formatted_address_invoice|escape:'htmlall':'UTF-8'|nl2br}
        {else}
            {if $order[orders].address_invoice.company}{$order[orders].address_invoice.company|escape:'htmlall':'UTF-8'}<br />{/if}
            {$order[orders].address_invoice.firstname|escape:'htmlall':'UTF-8'} {$order[orders].address_invoice.lastname|escape:'htmlall':'UTF-8'}<br />
            {$order[orders].address_invoice.address1|escape:'htmlall':'UTF-8'}<br />

Share this post


Link to post
Share on other sites

You are right. Compare both m4_invoice.tpl and m4_deliveryslip.tpl templates, <div> blocks around the 'Ship To' and 'Invoice To' labels. They are different and of course, you can exchange them.

 

I think it is a failure and the delivery address blocks should be the same as the invoice ones. I will fix it in the next version of the module.

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.0.3 (2014-06-04)
- Improved support for Multistore
  Added "shop" data in orders (invoices) and credit slips
  Added Smarty constant multishop_active describing activated shop
  Added the store name in the list of orders in the administration of the module
  Bulk printing of invoices and delivery slips in the administration of the module now supports Multistore settings
  All templates now use the new data and displays the data of the specific store in Multistore
- Addresses on all delivery slips and invoices are shown in the same form now
- More minor modifications in templates to improve the display of images
- New template "Invoices v2, non-zero" which prints orders with existing invoice together with non-zero total amount only
- All the templates for the administration module in the /modules/m4pdf/views/templates/admin pro usnadnění překladů folder was renamed to easier translations (PrestaShop v1.6)
- Fixed sorting of products in the "Catalog grouped by default categories, all data" template
- Fixed shop_price_final value for the catalog (PrestaShop v1.5 and later)

  • Like 1

Share this post


Link to post
Share on other sites
Hello, 

I have a problem. 

Module version 1.9.6 

PS. 1.5.6.2 

In version 1.4 I was printing on the invoice private message. 

In 1.5.6.2 I do not have this feature!. how can I fix it? 

regards Umberto

Share this post


Link to post
Share on other sites

Everything about order messages is here: http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1677379

 

The module has no support for invoice messages.

 

Hello, 
I have all the parameters. but since I upgraded to 1.5 will not print more private messages. 
how can I fix it? 
I bought the form for this function 
greetings

Share this post


Link to post
Share on other sites

You mentioned "the form". The important thing is if private messages are really normal PrestaShop private messages.

 

Look at one order (under Orders) if you can see private messages for the order and then try to print the order using the module and the "Debug template". You should see private messages on both places.

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.0.4 (2014-07-01)
- Expanded price_breakdown data, more information about compound taxes (for USA, Canada and other countries)
- New template "Invoices - compound taxes", showing the individual taxes
- New template "Catalog labels 32x57 mm, Dymo 11354"
- Added Russian translation (thanks to Maxim Loginov)
- Fixed a rounding issue in credit slips in some cases

 

A Canadian invoice example is at www.presta-addons.com/pdf/Invoice - Quebec taxes.pdf, and tax rules used at www.presta-addons.com/pdf/Canada Tax Rules.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Hello Vladimir,

 

I am running against a problem that i cant seem to fix.

 

When people pay by PayPal if want to show the transaction_id and date_add columns of my database.

I tried using: {$order[orders].order_payment.transaction_id|escape:'htmlall':'UTF-8'} and {$order[orders].order_payment.date_add|escape:'htmlall':'UTF-8'} but they don't seem to work. i also tried removing the |escape part, but with no luck. It gives me an empty value.

 

Hope you can help me!

 

Thanks,

 

Jaivy

Share this post


Link to post
Share on other sites

You cannot get details about payment that way. There are no $order[orders].order_payment data. Use the Debug template to see all available data.

 

I suggest to try print all messages - http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1677379 - and find out if it would be usable.

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.0.5 (2014-07-17)
- Fixed tax breakdown in invoices (only module v2.0.4 while multiple invoices generated at once)
- Fixed multiplied products in catalog templates (only module v1.9.6 and later, while individual categories set)

  • Like 1

Share this post


Link to post
Share on other sites

Hi Vladimir, i can't understand if with your module i can have 3 different invoice in automatic

 

Customer UE with vat

Company UE without vat and message with ARTXXXX of law

Customer and Company EXTRAUE without vat and different message with ARTYYYY of law

 

thanks

Share this post


Link to post
Share on other sites

You can, but the best approach is to have only one invoice template for all customers. In fact, all invoice templates quietly switch between VAT/non-VAT mode. The only remaining thing would be the different messages and it is about one {if} condition. I would do it for you for free.

Share this post


Link to post
Share on other sites

We are preparing a new line of highly configurable templates - for invoice and catalog. Stay tuned.

Share this post


Link to post
Share on other sites

Hello,

 

I would like to sorted the product of the template Catalog sorted by category organized in grid, price with tax  like the Product Page Catalog, but i don't know how to do.

 

Can you explain it to me please ?

Share this post


Link to post
Share on other sites

You can find some sorting examples in these catalog templates:

  • m4_catalog_category_alldata.tpl
  • m4_catalog_grid_category.tpl
  • m4_catalog_sorted_category.tpl
  • m4_catalog_sorted_category_tax.tpl

 

The key is to use sortby modifier and foreach loop, instead of section one.

 

*  Modifier: sortby - allows arrays of named arrays to be sorted by given field
* ------------------------------------------------------------------
* Example:
* {foreach from=$array|@sortby:field1 item=fielda}
* {foreach from=$array|@sortby:"field1,#field2,-field3,-#field4" item=fielda}
* {foreach from=$array|@sortby:"default_category.name" item=fielda}
*  '#' means sort numerically
*  '-' means to sort descending instead of ascending
*  '.' means sub-array identificator

Edited by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

Hi Tuk66, thanks for your help, i know what you mean, unfortunatly i'm a beginner and i don't know how to find the right Foreach @shortby.

 

I tried all shortby i find on all template done on M4, but it's not what i want.

 

Only template using this "{section name=products loop=$product}" working, but it's doesn't work when i try to change the m4_catalog_sorted_category_tax.tpl

 

Sorry to dirsturb you.

Share this post


Link to post
Share on other sites

There are two loop approaches in templates:

  • m4_catalog_grid_category.tpl uses foreach loop
  • m4_catalog.tpl uses section loop

You can rewrite one to the other and vice versa. Send me PM if you need to help with your concrete template.

Share this post


Link to post
Share on other sites

Hello,

 

great Module, thanks for the help. Now i have a question about status and custom PDF Template.

 

I generated with the Module a Template for reminder steps m4_reminder1.tpl.

Also generated a order status "1.reminder", than i integrated a button into the admin order template:

 

{if $currentState->id == 16}
            <a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}">
<img src="../img/admin/printer.gif" alt="{l s='1. Reminder'}" /> {l s='1. Reminder Print'}
</a>
           {else}
           {/if}
 
 
So if i change the order status to 1.reminder, than show me the button, but if push the button how can i generate the 
Template file 1.reminder instead from Invoice?
 
 
Thanks
 
Akos
Edited by m3442a (see edit history)

Share this post


Link to post
Share on other sites

Another question is: How can i input the Customer E-Mail Address into the m4_reminder1.tpl. (order Detail Category)?

Share this post


Link to post
Share on other sites

 

Hello,

 

great Module, thanks for the help. Now i have a question about status and custom PDF Template.

 

I generated with the Module a Template for reminder steps m4_reminder1.tpl.

Also generated a order status "1.reminder", than i integrated a button into the admin order template:

 

{if $currentState->id == 16}
            <a class="button" href="{$link->getAdminLink('AdminPdf')|escape:'htmlall':'UTF-8'}&submitAction=generateInvoicePDF&id_order={$order->id}">
<img src="../img/admin/printer.gif" alt="{l s='1. Reminder'}" /> {l s='1. Reminder Print'}
</a>
           {else}
           {/if}
 
 
So if i change the order status to 1.reminder, than show me the button, but if push the button how can i generate the 
Template file 1.reminder instead from Invoice?
 
 
Thanks
 
Akos

 

 

You can't generate an other document than the one set under Settings > BackOffice > Invoice.

Anyway, go to m4pdf.php file, search for

case 'adminpdf':

and try to change the code. The template is actually set on the line:

$object->generatePDF($filename, 'D', Configuration::get('M4TPL_PDF_ID_ORDER'), 1);

as Configuration::get('M4TPL_PDF_ID_ORDER')

 

It is a nice idea. I will add this feature to a new version.

Share this post


Link to post
Share on other sites

Another question is: How can i input the Customer E-Mail Address into the m4_reminder1.tpl. (order Detail Category)?

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

  • Like 1

Share this post


Link to post
Share on other sites

HOW TO use own fonts

 

Download the XYZ fonts as TTF file(s) and save to /modules/m4pdf/mpdf/ttfonts folder. Then go to /modules/m4pdf/mpdf/config_fonts.php file and add your font definition to $this->fontdata array.
 

"xyz" => array(
        'R' => "Xyz.ttf",
    ),


Use the font in your CSS style:

.custom_style {
    font-family: xyz;
}

Share this post


Link to post
Share on other sites

ok i got it: E-Mail is in the template. For the another question i also have a solution, it´s a little bit tricky but it works. 

I created two hooks and templates in PS for both status and PDF for the reminder ( 1.Reminder PDF, 2. Reminder PDF ).

than the hooks i integrated in the module and configured the override for the PDF templates. It works now i need it for that over 3 hours but now its perfect and i have Invoice Reminder Steps for PS.

Share this post


Link to post
Share on other sites

Hello,

i got a problem, i can't see private or public messages on pdf, i've already tried your code from here http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1677379 but still can't get anything. 

I also tried to see on the debug template the messages from a order and i get this (there is one private message on that order):

 

message => Array (8)
id_message => ""
id_cart => ""
id_customer => ""
id_employee => ""
id_order => ""
message => ""
private => ""
date_add => ""

Share this post


Link to post
Share on other sites
You are right i find it, but why i can't see it on the pdf? I've added all of them on the code

 



<!-- start private messages block -->
{if $order[orders].order_private_message}
<div class="clear">{l s='Messages:' mod='m4pdf'}</div>
{section name=private_message loop=$order[orders].order_private_message}
<div class="clear">{$order[orders].order_private_message[private_message].message|escape:'htmlall':'UTF-8'}</div>
{/section}
{/if}
<!-- end private messages block -->

<!-- start public messages block -->
{if $order[orders].order_public_message}
<div class="clear">{l s='Messages:' mod='m4pdf'}</div>
{section name=public_message loop=$order[orders].order_public_message}
<div class="clear">{$order[orders].order_public_message[public_message].message|escape:'htmlall':'UTF-8'}</div>
{/section}
{/if}
<!-- end public messages block -->

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


 

but still nothing.

 

customer_message => Array (1)

0 => Array (20)id_customer_message => "92"

id_customer_thread => "56"

id_employee => "1"

message => "Μπήκε δωρέαν γιατί σε προηγούμενη

παραγγελία τη..."

file_name => ""

ip_address => "0"

user_agent => ""

date_add => "2014-08-25 10:56:21"

date_upd => "2014-08-25 10:56:21"

private => "1"

read => "1"

id_shop => "1"

id_lang => "1"

id_contact => "0"

id_customer => "298"

id_order => "454"

id_product => "0"

status => "open"

email => ""

token => "jhsKMSdGZx5c"

Share this post


Link to post
Share on other sites

I forgot Customer messages which are available from PS 1.4

<!-- start customer messages block (PrestaShop v1.4 and later) -->
{if $order[orders].customer_message}
<div class="clear">{l s='Customer\'s messages:' mod='m4pdf'}</div>
{section name=index loop=$order[orders].customer_message}
<div class="clear">{$order[orders].customer_message[index].message|escape:'htmlall':'UTF-8'}</div>
{/section}
{/if}
<!-- end customer messages block -->

Share this post


Link to post
Share on other sites

I'm having an issue when using multishops:

 

On the Invoices Page, when creating the invoices (either by status or date), I can only create PDFs for the main shop.

The second shop (in the same group) doesn't get any PDFs printed.

 

Regardless whether I set the Multistore configuration for to "Default Group", "Shop 1" or "Shop 2", I always get the invoices for Shop 1.

 

Any idea how to fix that?

 

Thanks :)

Share this post


Link to post
Share on other sites

What version of the module are you using? Multistore features were enhanced in v2.*.

Share this post


Link to post
Share on other sites

Thanks for the fast reply.

I'm using 1.9.6, which seems to be the latest available one for PrestaShop 1.5.

I can't switch to PrestaShop 1.6 yet, as it doesn't include everything that's needed for a German onlineshop (need to wait for 1.6.2).

Share this post


Link to post
Share on other sites

The latest version is 2.0.5 and works for PrestaShop v1.1 - 1.6. You haven't seen the latest version because there is no free upgrade at Addons (their policy).

Share this post


Link to post
Share on other sites

Ah, I see, thanks.

Yes, I didn't buy it at presta-addons but directly at PrestaShop (as I already had an account registered at PrestaShop).

 

Is there a way to transfer that buy to prest-addons to receive the free upgrade or do I have to buy it again?

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.0.6 (2014-09-01)
- Added "parents_categories_reversed" and "parents_categories_level_reversed" data in catalogs
- New template "Orders, CSV" (export orders as HTML, copy the entire page and paste CSV to a text editor or Excel)
- New template "Catalog in grid, with categories"
- New template "Order items list"
- Fixed compound taxes data (only module v2.0.5 in some cases)
- The "Manage translations" block is now also displayed in PrestaShop v1.6.0.7 and later

  • Like 1

Share this post


Link to post
Share on other sites

Hi i have installed your module but i can't change footer of invoice.

i want change ""An electronic version of this invoice is available in your account. To access it, log in to the"" and ""website using your e-mail address and password (which you created while placing your first order).""

i see that this diciture are correctly translate in italian but i want change to other text. So if i go on module traslation for change this for my language and my theme i have no result in invoice. In invoice i have same text also if i change in translation module.

I change correct version of invoice that i use, but i have try to change all version of invoice but no result

thanks

Share this post


Link to post
Share on other sites

I know nothing about your PrestaShop as well as module versions. In general, here are some hints:

 

- you can replace all texts by translation, even English ones

- the footer is closed between the <htmlpagefooter> and </htmlpagefooter> tags

- you are using the buggy combination of the module and PrestaShop (as example 1.9.4 and PS 1.4)

- you didn't use the translation links in module administration (it may cause wrong translations, must be "Core (no theme selected)")

  • Like 1

Share this post


Link to post
Share on other sites

I know nothing about your PrestaShop as well as module versions. In general, here are some hints:

 

- you can replace all texts by translation, even English ones

- the footer is closed between the <htmlpagefooter> and </htmlpagefooter> tags

- you are using the buggy combination of the module and PrestaShop (as example 1.9.4 and PS 1.4)

- you didn't use the translation links in module administration (it may cause wrong translations, must be "Core (no theme selected)")

Hi i have buy module today, i have last version and prestashop 1.6.0.6

i know how change and i change text in translation but after i don't see change in invoice, in footer of invoice i see evrytime same text, also if i change text

can you help?

Share this post


Link to post
Share on other sites

Templates are cached except for two situations:

 

1) you are editing the template in the on-line editor

2) you have set the "Debug mode" in module administration and create the first PDF there as well

Share this post


Link to post
Share on other sites

Templates are cached except for two situations:

 

1) you are editing the template in the on-line editor

2) you have set the "Debug mode" in module administration and create the first PDF there as well

Hi i don't understand, i don't want change template, only text, see screen and let me know why text not change in invoice

 

ScreenClip.png

 

ScreenClip1.png

 

ScreenClip2.png

 

ScreenClip3.png

 

ScreenClip4.png

Edited by davids1970 (see edit history)

Share this post


Link to post
Share on other sites

It is about translations. PDF invoices are not related to a theme and you must always set "Core (no theme selected)".

 

post-92842-0-65666600-1409587533_thumb.jpg

Share this post


Link to post
Share on other sites

You can, but the best approach is to have only one invoice template for all customers. In fact, all invoice templates quietly switch between VAT/non-VAT mode. The only remaining thing would be the different messages and it is about one {if} condition. I would do it for you for free.

 Hi thanks for solution to change text in core module.

About this quote, you told me to add if for differnt messages, how we can do?

I want two different message for no tax area, if client is extra ue ART 21 with description of law, and if client is inside UE ART 25 with description of law

thanks

Share this post


Link to post
Share on other sites

See my zones example. There are zones:

1     Europe
2     North America
3     Asia
4     Africa
5     Oceania
6     South America
7     Europe (non-EU)
8     Central America/Antilla

Customers from the zone Europe can pay VAT (1-tax) or cannot (VAT registered customer, 1-notax).

This snippet is used in all invoice templates:

{assign var="without_tax" value=0}
{if !$order[orders].shop.use_taxes || ($order[orders].price_breakdown.totalProductsWithTax == $order[orders].price_breakdown.totalProductsWithoutTax)}
    {assign var="without_tax" value=1}
{/if}

Variable $without_tax=1 means that the customer is from zones 2-8 or zone 1 while is VAT registered.

So we have 3 situations:
1-tax
1-notax
2-8

and the condition will be:
 

{if $order[orders].address_invoice.country.id_zone == 1 && !$without_tax}
    action for 1-tax
{elseif $order[orders].address_invoice.country.id_zone == 1 && $without_tax}
    action for 1-notax
{else}
    action for 2-8
{/if}

post-92842-0-50197700-1409727196_thumb.jpg

Share this post


Link to post
Share on other sites

 

See my zones example. There are zones:

 

1     Europe

2     North America

3     Asia

4     Africa

5     Oceania

6     South America

7     Europe (non-EU)

8     Central America/Antilla

 

Customers from the zone Europe can pay VAT (1-tax) or cannot (VAT registered customer, 1-notax).

 

This snippet is used in all invoice templates:

{assign var="without_tax" value=0}
{if !$order[orders].shop.use_taxes || ($order[orders].price_breakdown.totalProductsWithTax == $order[orders].price_breakdown.totalProductsWithoutTax)}
    {assign var="without_tax" value=1}
{/if}

Variable $without_tax=1 means that the customer is from zones 2-8 or zone 1 while is VAT registered.

 

So we have 3 situations:

1-tax

1-notax

2-8

 

and the condition will be:

 

{if $order[orders].address_invoice.country.id_zone == 1 && !$without_tax}
    action for 1-tax
{elseif $order[orders].address_invoice.country.id_zone == 1 && $without_tax}
    action for 1-notax
{else}
    action for 2-8
{/if}

hi can you explain better what i do?

i want:

1-tax (no action, invoice is already good)

1-notax (i want this after product):

Art. 25 *Operación no sujeta a iva en cumplimiento de la Directiva Comunitaria 2006/112/CE de 28 de Noviembre de 2006 y del Art. 84 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.

2-8-notax (i want this after product)

Art. 21 * Operación exenta según Artículo 21.1 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.

 

thanks

Share this post


Link to post
Share on other sites

Try this (under the order items):

{if $order[orders].address_invoice.country.id_zone == 1 && $without_tax}
    {l s='Art. 25 *Operación no sujeta a iva en cumplimiento de la Directiva Comunitaria 2006/112/CE de 28 de Noviembre de 2006 y del Art. 84 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.' mod='m4pdf'}
{elseif $order[orders].address_invoice.country.id_zone > 1}
    {l s='Art. 21 * Operación exenta según Artículo 21.1 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.' mod='m4pdf'}
{/if}

Share this post


Link to post
Share on other sites

 

Try this (under the order items):

{if $order[orders].address_invoice.country.id_zone == 1 && $without_tax}
    {l s='Art. 25 *Operación no sujeta a iva en cumplimiento de la Directiva Comunitaria 2006/112/CE de 28 de Noviembre de 2006 y del Art. 84 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.' mod='m4pdf'}
{elseif $order[orders].address_invoice.country.id_zone > 1}
    {l s='Art. 21 * Operación exenta según Artículo 21.1 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.' mod='m4pdf'}
{/if}

hi i have sintax error, can you explain where excatly i insert this code?

Share this post


Link to post
Share on other sites

I tried it and there is no syntax error in this snippet.The condition "prints" just text so put it where you need. Of course bellow the line:

 

{assign var="without_tax" value=0}

 

because you need the $without_tax variable.

Share this post


Link to post
Share on other sites

I tried it and there is no syntax error in this snippet.The condition "prints" just text so put it where you need. Of course bellow the line:

 

{assign var="without_tax" value=0}

 

because you need the $without_tax variable.

{/if}

        

        {assign var="without_tax" value=0}

        {if !$order[orders].shop.use_taxes || ($order[orders].price_breakdown.totalProductsWithTax == $order[orders].price_breakdown.totalProductsWithoutTax)}

        {assign var="without_tax" value=1}

            {if $order[orders].address_invoice.country.id_zone == 1 && $without_tax}

            {l s='Art. 25 *Operación no sujeta a iva en cumplimiento de la Directiva Comunitaria 2006/112/CE de 28 de Noviembre de 2006 y del Art. 84 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.' mod='m4pdf'}

            {elseif $order[orders].address_invoice.country.id_zone > 1}

            {l s='Art. 21 * Operación exenta según Artículo 21.1 de la Ley 37/1992, de 28 de Diciembre, del Impuesto Sobre el Valor Añadido.' mod='m4pdf'}

        {/if}

 

i have this and sintax error, i don't know how correct, i'm not a technical

Share this post


Link to post
Share on other sites

HOW TO show all product images in invoice

 

Insert the code below inside the order_detail loop ({section name=detail loop=$order[orders].order_detail}) to display product features. This example shows creating object instances inside a template (needs at least v2.1.0).

{factory assign="product" class="Product" id_product=$order[orders].order_detail[detail].product_id id_lang=$m4_actual_language}
{if is_object($product)}
    {assign var="images" value=$product->getImages($m4_actual_language)}
    {section name=image loop=$images}
        {if $images[image].id_image}
            {assign var="id_product_id_image" value="`$order[orders].order_detail[detail].product_id`-`$images[image].id_image`"}
            <img src="{imageLink name=$order[orders].order_detail[detail].product.link_rewrite ids=$id_product_id_image}" style="width:18mm; margin:1mm" />
        {/if}
    {/section}
{/if}
Edited by tuk66 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hello,

i was looking if i could export on the invoices the Discount description that only visible to admins on BO, but i can't find the variable on the debug mode

order_discount => Array (2)
0 => Array (7)
id_order_discount => "35"
id_order => "978"
id_discount => "26"
name => "V145C259O788"
value => "1.27"
value_tax_excl => "1.03"
free_shipping => "0"

 

 

Could you help me please?

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.1.0 (2014-10-15)
- Added support for Order returns - data, "Order returns" template (up to PrestaShop v1.5 is support only in module administration)
- Added "Transit time" data, alias Delay, for carriers
- Added "customer_message_all" data in orders/invoices - messages in all languages at once (PrestaShop v1.4 and later)
- Added Smarty function "factory" which returns an object instance
- All invoice templates now show "Footer text" at the bottom of the invoice
- New template "Invoices with discount"
- New template "Invoices with French legal notes"
- Fixed Base price ("Invoices with more columns" template, m4_invoice_4.tpl)
- Fixed translation in orders: shop.invoice_free_text, shop.invoice_prefix a shop.delivery_prefix
- Fixed message "You have an error in your SQL syntax" when setting Customer's language (only module v2.0.4 and later)
- Fixed more messages "PHP Notice" and "PHP Warning" (server log only)

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

i was looking if i could export on the invoices the Discount description that only visible to admins on BO, but i can't find the variable on the debug mode

 

Could you help me please?

I suppose there is not solution for this?

Share this post


Link to post
Share on other sites

Hello,

i was looking if i could export on the invoices the Discount description that only visible to admins on BO, but i can't find the variable on the debug mode

 

Could you help me please?

The answer should be the Private customer's messages part at http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1677379, but it depends.

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

 

Is it possible to display more than one product image on a catalogue page? I am doing a catalogue, and would like to have more than just the cover image on the page. I mean the images we upload in the backoffice when creating products.

 

For example you have written:

 

<td width="40%">        
            {assign var="id_product_id_image" value="`$product[products].id_product`-`$product[products].image.id_image`"}
            <img class="photo" src="{if $product[products].image.id_image}{imageLink name=$product[products].link_rewrite ids=$id_product_id_image}{else}{$conf.pdf_iso_lang}.jpg{/if}" />
</td>

 

It would be nice to have another one or two extra images underneath, for example:

 

<td width="40%">        
            {assign var="id_product_id_image" value="`$product[products].id_product`-`$product[products].image.id_image`"}
            <img class="photo" src="{if $product[products].image.id_image}{imageLink name=$product[products].link_rewrite ids=$id_product_id_image}{else}{$conf.pdf_iso_lang}.jpg{/if}" />
</td>

 

<td width="40%">        
image 2
</td>

 

<td width="40%">        
image 3
</td>

 

 

Thanks for any suggestions

Edited by mowax (see edit history)

Share this post


Link to post
Share on other sites

Yes, data for all images are available as array. You can try to process
 

$product[products].images


in a loop.

Share this post


Link to post
Share on other sites

There was an error

Cannot find a zone for the invoice address. Check if addresses linked to the order still exist.

How to solve it?

Share this post


Link to post
Share on other sites

Check if addresses linked to the order still exist.

 

The database is "corrupted". Some addresses, zones, countries are deleted but the linked orders still appear.

Share this post


Link to post
Share on other sites

Yes, order still exist, and working good (in AdminOrders).

 

I dont have problem in Order tab, but only in Orders with details, invoices.

Share this post


Link to post
Share on other sites

The module checks customer's invoice address to get tax rates and create the correct tax breakdown.

 

Can be that customer's country (or state) has been removed or is not a part of any zone?

Share this post


Link to post
Share on other sites

I would like to be able to download the order (delivery slip) with error, if exist (without customers invoice address if is empty) ;)

Share this post


Link to post
Share on other sites

The module cannot work with partly corrupted data. That would cause unvisible problems.

Share this post


Link to post
Share on other sites

I have thought that invoice address is mandatory. If you use only one address due to a patch, you should fill both invoice and delivery address ID with the same number.

Share this post


Link to post
Share on other sites

Yes, data for all images are available as array. You can try to process

 

$product[products].images

in a loop.

Thank you for your fast reply. I'm not much of a programmer... could anyone please help with an example of how to implement this? My php skills are self-taught and very basic, I don't understand about arrays and loops etc.

Share this post


Link to post
Share on other sites

Here is a basic loop to show all images (catalog).

{foreach from=$product[products].images item=images}
    {assign var="id_product_id_image" value="`$product[products].id_product`-`$images.id_image`"}
    <img class="photo" src="{if $product[products].image.id_image}{imageLink name=$product[products].link_rewrite ids=$id_product_id_image}{else}{$conf.img_prod_dir}{$conf.pdf_iso_lang}.jpg{/if}" />
{/foreach}

Send me PM, if you would need more precise layout or adapt a template.

  • Like 2

Share this post


Link to post
Share on other sites

Someone can explain the meaning of this syntax ?:

{foreach from=$product[products].images item=images}

 

{assign var="id_product_id_image"

Share this post


Link to post
Share on other sites

hi!

 

I bought the module at addons.prestashop.com

 

I send a support email 15 days ago without response

 

Can contact me for give you my backend credentials??

 

I have the module installed but i cant generate PDFS appears ERROR ACTIVATE DEBUG MODE 

 

 

THANKS!

Share this post


Link to post
Share on other sites

When exactly and where did you send the support request? It is important to know, because I have no open request at the moment.