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.1.1 (2014-12-01)
- Added support for single and double quotation marks in template names
- New template "Invoices - 75mm wide" for thermal printers
- Improved domain checking within installation (Multistore)
- Debug template also shows the SQL queries (in /config/defines.inc.php must be set define('_PS_DEBUG_PROFILING_', true); )
- Better coding standards compliance (changed the names of methods and variables, without affecting templates)
- Fixed proper displaying of images in invoices and delivery slips (in some cases in Multistore)
- Fixed more messages "PHP Notice" (server log and templates)

Edited by tuk66 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hello Tuk66,

 

Recently i try to find how to display all combination ean on my catalog, unfortunatly i dind't find anything about that.

So i would like to know if it's possible to do it ?

Share this post


Link to post
Share on other sites

Look at the "Catalog with attributes" template - m4_catalog_attribute.tpl.

 

You can show EAN13 code of every combination as

{$product[products].product_attribute[attributes].ean13|escape:'htmlall':'UTF-8'}

in

{section name=attributes loop=$product[products].product_attribute}
...
{/section}

loop.

Share this post


Link to post
Share on other sites

Yes. You can work with one product item

 

$product[products]

 

in {section name=products loop=$product} loop.

  • Like 1

Share this post


Link to post
Share on other sites

Hello Tuk66,

 

I have a wierd issue on the "m4_catalog_category_alldata.tpl" when i put <barcode code="{$products.product_attribute[attributes].ean13|escape:'htmlall':'UTF-8'}" type="EAN13" height="0.5" class="barcode" /> to got all EAN13 from my combinations, the first combination is never there.

 

All other is ok, but the first combinations are just not there.

 

Do you have any idea about that please ?

Share this post


Link to post
Share on other sites

It is because combinations are displayed at more than one place in the template. You need to put your code at all places. For example, search "Reference:" to see that.

Share this post


Link to post
Share on other sites

In 2015 becomes effective Directive 2008/8/EC about electronic services. More details and a discussion is at http://www.prestashop.com/forums/topic/387405-open-letter-to-prestashop-and-the-community-eu-vat-rule/

 

The v2.1.2 of this module complies with this directive.

 

Tested tax rules:

http://www.presta-addons.com/pdf/eu_service_taxes_2015.png

"EU Supply of services" tax rule have to be set for all electronic services sold using the standard tax rate.

"EU E-books" tax rule have to be set for e-books and other services sold using the reduced tax rate.

Download taxes for all EU countries under Localization and then create 2 new tax rules using all of these taxes.

 

Examples:

Invoice - EU electronic services - http://www.presta-addons.com/pdf/Invoice - EU electronic services.pdf
Tax report - http://www.presta-addons.com/pdf/Tax report.pdf

Tax report, CSV, imported in Excel - http://www.presta-addons.com/pdf/Tax report (XLSX, formatted).xlsx

 

Questions and comments are welcome.
 

Edited by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

I'm sorry, but unfortunatly i don't know how to do, what you say, even if i put the same code to another place i just got more barcode but never the first one of my combination.

 

Edit: Sorry, that was so easy, just put in the wrong place it's work now. Thx a lot

Edited by Yuki707 (see edit history)

Share this post


Link to post
Share on other sites

For those who want to try out orders with new EU tax rules:

 

- download Selenium IDE and install in Firefox (http://www.seleniumhq.org/download/)

- download all 3 attachments (Selenium test cases) and change the target for ADMIN_URL to your_domain/your_admin_folder

- run 1-PS16NewLocalizationEUTaxes.html case in the Selenium IDE (install taxes for all 28 EU countries)

- run 2-PS16NewLocalizationLU2015Taxes.html case (new 2015 tax rates for Luxembourg)

- run 3-PS16SetLocalizationEUTaxRules.html case (create EU Supply of services and EU E-books tax rules, disable all other tax rules instead of these two)

- enable all tax rules applicable for your country under Localization > Tax Rules

- set the "EU Supply of services" or "EU E-books" tax rule for all electronic services, e-books and other relevant products

- create test orders (you can mix products with more than one tax rule)

 

Disclaimer: use this procedure on your own risk, preferably in your test environment.

 

PM me if you want also test the new "Invoices - EU electronic services" or "Tax report" templates.

http://www.presta-addons.com/pdf/Invoice - EU electronic services.pdf

http://www.presta-addons.com/pdf/Tax report.pdf

http://www.presta-addons.com/pdf/Tax report (grouped by days).pdf

http://www.presta-addons.com/pdf/Tax report (CSV).csv
http://www.presta-addons.com/pdf/Tax report (XLSX, formatted).xlsx

1-PS16NewLocalizationEUTaxes.html

2-PS16NewLocalizationLU2015Taxes.html

3-PS16SetLocalizationEUTaxRules.html

Edited by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

I have tried to comply with the EU directive using the two new tax rules, as described in http://www.presta-addons.com/pdf/eu_service_taxes_2015.png. It is on the order side. Means you can create valid orders using these two tax rules, together with previously used tax rules for the country of headquarters.

 

On the invoice side, I have improved the M4 PDF Extensions module. There are new data available for templates, together with the "Invoices - EU electronic services" and "Tax report" templates. These new features will be in the next version (2.1.2) and the upgrade is immediately available for everyone to test (PM).

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.2 (2014-12-22)
- Expanded price_breakdown data, more information about individual taxes
- New template "Invoices - EU electronic services", shows individual taxes to comply with Directive 2008/8/EC
- New template "Tax report", suits Directive 2008/8/EC
- New template "Tax report, CSV"
- New template "Tax report (grouped by days)"
- Added feature to set delivery slip file names in different languages (Orders)
- Template "Invoices with French legal notes" is no longer affected by the zones
- Improved behavior when the module is Disabled
- Fixed base price, when discount for the group of customers is applied (template "Invoices with discount" only)
- Fixed printing delivery notes on the Orders page (only module v2.1.1)

 

More details and examples are at http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-11?do=findComment&comment=1903730

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

I just want to have a few "product features" displayed into the Catalog template, I'm trying what you said (here below) changing "Fill_in_name_of_feature" with a real feature but it doesn't work. Alternatives?

Thanks

 

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

  • Like 1

Share this post


Link to post
Share on other sites

This example is suitable for invoices. For using in a catalog template, see for example the "Catalog with attributes and features" template, m4_catalog_attribute_features.tpl. There is this block:

{* start product features *}
{if $product[products].product_feature}
    <br />
    <table autosize="1" class="w100" style="page-break-inside:avoid">
    {section name=features loop=$product[products].product_feature}
        <tr>
            <td style="padding-right: 8mm"><strong>{$product[products].product_feature[features].name|escape:'htmlall':'UTF-8'}:</strong></td>
            <td>{$product[products].product_feature[features].value|escape:'htmlall':'UTF-8'}</td>
        </tr>
    {/section}
    </table>
{/if}
{* end product features *}

Share this post


Link to post
Share on other sites

 

This example is suitable for invoices. For using in a catalog template, see for example the "Catalog with attributes and features" template, m4_catalog_attribute_features.tpl. There is this block:

{* start product features *}
{if $product[products].product_feature}
    <br />
    <table autosize="1" class="w100" style="page-break-inside:avoid">
    {section name=features loop=$product[products].product_feature}
        <tr>
            <td style="padding-right: 8mm"><strong>{$product[products].product_feature[features].name|escape:'htmlall':'UTF-8'}:</strong></td>
            <td>{$product[products].product_feature[features].value|escape:'htmlall':'UTF-8'}</td>
        </tr>
    {/section}
    </table>
{/if}
{* end product features *}

Thank you for you're reply, I'm already working on that template but I need to display into the pdf only some product features not to have all of them. Thanks in advance for your time.

Share this post


Link to post
Share on other sites

Then add a condition inside the {section}.

{section name=features loop=$product[products].product_feature}
    {if $product[products].product_feature[features].name == 'Fill_in_name_of_feature'}
        <td style="padding-right: 8mm"><strong>{$product[products].product_feature[features].name|escape:'htmlall':'UTF-8'}:</strong></td>
        <td>{$product[products].product_feature[features].value|escape:'htmlall':'UTF-8'}</td>
    {/if}
{/section}

or similarly for two features

{if $product[products].product_feature[features].name == 'name1' || $product[products].product_feature[features].name == 'name2'}
  • Like 3

Share this post


Link to post
Share on other sites

Hello,

I need a module for printing labels with barcode and customizable fields. I think M4 PDF is my solution.

Before to purchase the module, could you help me with any doubts, please?.

 

- M4 PDF is able to generate automatically as many labels as you have product amount?

( For example iphone quantity= 20, then generate a pdf with labels for all the products and 20 labels for iphone) .
- Is M4 pdf able to generate a pdf for products with combinations?

 

- Is M4 PDF able to generate a pdf for labels with diferents size? (for example: print at APLI or AVERY labels in a A4).

- Is there any option for resizing the image of the barcode?

 

Thanks in advance!.

Edited by OscarGA (see edit history)

Share this post


Link to post
Share on other sites

Hi! 
 
I would like to have a button in Catalog > Product (2) for print report (from catalog>products template) for selected products (1).
 
In M4 PDF module i can make raport from only for one product, but i need for few, and i need button in display product tab..
 
Can u help me with this? No idea...

 

259.jpg

Edited by ukwyspa (see edit history)

Share this post


Link to post
Share on other sites

Hello,

I need a module for printing labels with barcode and customizable fields. I think M4 PDF is my solution.

Before to purchase the module, could you help me with any doubts, please?.

 

- M4 PDF is able to generate automatically as many labels as you have product amount?

( For example iphone quantity= 20, then generate a pdf with labels for all the products and 20 labels for iphone) .

- Is M4 pdf able to generate a pdf for products with combinations?

 

- Is M4 PDF able to generate a pdf for labels with diferents size? (for example: print at APLI or AVERY labels in a A4).

- Is there any option for resizing the image of the barcode?

 

Thanks in advance!.

 

Many labels:

Yes, the quantity is available so you can adapt a catalog template to repeat the label more times.

 

Combinations:

Yes. Also combinations data are available.

 

Different label size:

Yes. You can define the paper size (A4) as well as the label size - number of labels vertically and horizontally, margin including. There are many label templates availale so it is quite easy to learn from them.

 

Barcode:

Yes, completely.

  • Like 1

Share this post


Link to post
Share on other sites

Hi! 

 

I would like to have a button in Catalog > Product (2) for print report (from catalog>products template) for selected products (1).

 

In M4 PDF module i can make raport from only for one product, but i need for few, and i need button in display product tab..

 

Can u help me with this? No idea...

 

259.jpg

 

You can create the report or catalog in module administration for one or more categories, not individual products. I will think about an improvement.

Share this post


Link to post
Share on other sites

Many labels:

Yes, the quantity is available so you can adapt a catalog template to repeat the label more times.

 

Combinations:

Yes. Also combinations data are available.

 

Different label size:

Yes. You can define the paper size (A4) as well as the label size - number of labels vertically and horizontally, margin including. There are many label templates availale so it is quite easy to learn from them.

 

Barcode:

Yes, completely.

Thank you very much!!!!.

Share this post


Link to post
Share on other sites

Let me explain in Spanish.

Perfecto y además nos ha ayudado a solventar todos nuestros problemas con la instalación del módulo.

Un módulo muy recomendable y un personal muy atento.

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.4 (2015-01-30)
- Fixed total amount and tax breakdown in credit slips while applying vouchers (PrestaShop v1.6.0.11 and later)
- Fixed "Catchable fatal error: Argument 3 passed to M4Product::displayRecurseCategory() must be an array", M4Category also (upgraded PrestaShop v1.5 and later)

 v2.1.3 (2015-01-07)
- Accurate and comprehensive data for credit slips (older credit slip templates credits may not be fully compatible)
- Credit slip templates show accurately partial refunds and refund of shipping
- Credit slip templates include the option to display all order items for a partial refund
- Refined base amounts in the tax breakdown (credit slips only)
- Support for printing invoices and delivery slips, even if there are not in the database
- New template "Invoices - packs itemized"
- Fixed the block for language selection on the Order page (Italian only)
- mPDF library moved to /m4pdf/libraries folder

 

 

[MORE INFO] Inaccurate credit slip in 1.6.0.11

https://www.prestashop.com/forums/topic/398872-inaccurate-credit-slip-in-16011/?hl=%2Bcredit

Edited by tuk66 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hi tuk66,

 

A couple of things...

 

-I bought your module today via the official prestashop marketplace.  Does this mean I cannot get the latest version?

-I've been trying out the Delivery Slips and although I have a warehouse and location set up for the product which is on the order, the Location field on your PDF is blank

also,

-On the PDF's the module generates, the product images are shown as a little red cross in a box even though there is a cover image set up for the product.

 

Any idea what might be going on?...

Share this post


Link to post
Share on other sites

We uploaded the upgraded version to Addons as well, but it will take some time to approve. Honestly, it is harder and harder to comply to all requirements, mostly formal.

 

 

As for the location. Try these two templates:

    Delivery slips with images and location (m4_deliveryslip_image.tpl)
    Invoices - Integrated label 85x54 mm (m4_invoice_label2.tpl)

where the location is shown through {$order[orders].order_detail[detail].warehouse_product_location.location|escape:'htmlall':'UTF-8'}

You can also try the Debug template (preferably in HTML) and then search for location to see data in context.


As for the images. It means the images are blocked or don't exist. Most likely .htaccess rules block them. Try the Debug template to HTML to see <img> sources.

Share this post


Link to post
Share on other sites

hello, 

I want to insert the e-mail customer in m4_invoice_image.tpl

i tried this.

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

and this

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

but is wrong, please help

Share this post


Link to post
Share on other sites

Customer's email is in ps_customer table. Use

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

Share this post


Link to post
Share on other sites

I just installed this module, I have been testing and found that on the front office in the product page itself when you click "Pdf Product Page" I get an error notice. 

 

post-905105-0-76591800-1423754016_thumb.png

 

I have the back office, I think set correctly. 

 

post-905105-0-02628000-1423754078_thumb.png

 

I activated the extra pdf option and tried it and had no issues. I assume that I might be missing something. Any one got suggestions.

 

Thanks

 

Mark

 

Prestashop 1.6.0.11 

Share this post


Link to post
Share on other sites

I am having an issue with the Catalog with attributes and features.

 

I have several products that have attributes and some of the attributes are priced higher. When I use the Catalog with Attributes and Features for catalog pdf It shows the same price for all attributes. 

 

post-905105-0-53739000-1423774302_thumb.png

 

Any advise. Thanks

Mark

 

Share this post


Link to post
Share on other sites

Need a little help with sorting of products between catalog pdfs.

 

Below is an image of 2 pdf side by side.

left = Catalog Template

right = Catalog grouped by default categories, all data

 

post-905105-0-47485300-1423777888_thumb.png

 

As you can see they are both sorted differently. I need the Catalog grouped by default categories, all data template to be sorted same way the Catalog template.

 

any suggestions?

 

Thanks

Mark

 

 

Share this post


Link to post
Share on other sites

I just installed this module, I have been testing and found that on the front office in the product page itself when you click "Pdf Product Page" I get an error notice. 

 

attachicon.gifPdfError.png

 

I have the back office, I think set correctly. 

 

attachicon.gifpdfbackoffice.png

 

I activated the extra pdf option and tried it and had no issues. I assume that I might be missing something. Any one got suggestions.

 

Thanks

 

Mark

 

Prestashop 1.6.0.11 

 

The error is:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://hoffmandistro.com/modules/m4pdf/pdf.php. This can be fixed by moving the resource to the same domain or enabling CORS.

 

You are using HTTP protocol only. All HTTPS pages are rewritten to HTTP ones. But you have probably enabled SSL in your shop and that is the problem.

Share this post


Link to post
Share on other sites

 

I am having an issue with the Catalog with attributes and features.

 

I have several products that have attributes and some of the attributes are priced higher. When I use the Catalog with Attributes and Features for catalog pdf It shows the same price for all attributes. 

 

attachicon.gifCatalog_Price_Issue.png

 

Any advise. Thanks

Mark

 

 

You are using special prices and the template example just show the combination prices. I don't know your motivation, but without any special prices for country, customer's group, currency or quantity it is better to set all prices under Combinations.

 

There are two catalog templates showing specific prices - Catalog with specific prices, filtered and Catalog filtered by specific prices occurrence. Of course, things are more complicated with specific prices.

Share this post


Link to post
Share on other sites

Need a little help with sorting of products between catalog pdfs.

 

Below is an image of 2 pdf side by side.

left = Catalog Template

right = Catalog grouped by default categories, all data

 

attachicon.gifProduct_sort.png

 

As you can see they are both sorted differently. I need the Catalog grouped by default categories, all data template to be sorted same way the Catalog template.

 

any suggestions?

 

Thanks

Mark

 

The Catalog template have no in-template sorting. Products are sorted according to the actuall sorting used on the page.

 

The Catalog grouped by default categories, all data template has buil-in sorting by parents_categories_level & name. See the code:

{foreach from=$product|@sortby:"parents_categories_level,name" item=products name=cycle}

Share this post


Link to post
Share on other sites

 

The Catalog template have no in-template sorting. Products are sorted according to the actuall sorting used on the page.

 

The Catalog grouped by default categories, all data template has buil-in sorting by parents_categories_level & name. See the code:

{foreach from=$product|@sortby:"parents_categories_level,name" item=products name=cycle}

Thanks for the explanation. Got it.. Thanks

Share this post


Link to post
Share on other sites

You are using special prices and the template example just show the combination prices. I don't know your motivation, but without any special prices for country, customer's group, currency or quantity it is better to set all prices under Combinations.

 

There are two catalog templates showing specific prices - Catalog with specific prices, filtered and Catalog filtered by specific prices occurrence. Of course, things are more complicated with specific prices.

Tuk66,

 

Thanks for the explanation. I am new to Prestashop and still getting my head wrapped around it. Manage the increase prices under the combinations will work for now. 

 

Thanks again

Mark

Share this post


Link to post
Share on other sites

The error is:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://hoffmandistro.com/modules/m4pdf/pdf.php. This can be fixed by moving the resource to the same domain or enabling CORS.

 

You are using HTTP protocol only. All HTTPS pages are rewritten to HTTP ones. But you have probably enabled SSL in your shop and that is the problem.

Tuk66

 

Yes I am using SSL, I disabled the SSL and this resolved the error issue, but I need to have SSL enabled. Can you please explain how tp move the resources to the same domain or enabling the CORS.

 

Thanks

Mark

Share this post


Link to post
Share on other sites

There is no problem with SSL. Use HTTPS protocol for all pages. Now any HTTPS page is redirected to HTTP.

Share this post


Link to post
Share on other sites

Tuk66,

 

I would like to add the Catalog PDF which I will create from the backend to my customers account page. Is there an easy solution to this?

 

post-905105-0-56166100-1423847819_thumb.jpg

 

Thanks

Mark

Share this post


Link to post
Share on other sites

You have to hook the customer's account. You can patch m4pdf.php file or create a light module for this.

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.0 (2015-03-16)

 

- PrestaShop Cloud compatible
- mPDF library upgraded to version 5.7.4
  The library is located under /modules/m4pdf/libraries/mpdf
- New data total_amount_tax_excl, total_amount_tax_incl, unit_amount_tax_excl, unit_amount_tax_excl for invoice items
- All invoices templates now use the new data to accurately display the items in all versions of PrestaShop, including upgrades
- Naming amounts united on all invoices and credit slips
- Added product_feature data (Features) for orders/invoices
- New template "Invoices - product features"
- Full Multistore support of product_feature data for catalog
- Advanced data about logged user ($user)
- Unification of specific prices with product administration in "Catalog with specific prices, filtered" template (m4_catalog_specific_prices.tpl)
- Fixed file names in a language other than English

  • Like 1

Share this post


Link to post
Share on other sites

Hi.

I would like to add a link to generate a product category with ID = 11.
Each customer could ever generate a catalog.
Is this possible?

Share this post


Link to post
Share on other sites

Add this snippet in your category.tpl file

{if $HOOK_M4_PDF_CATEGORY}{$HOOK_M4_PDF_CATEGORY}{/if}

to show a button for the current category. It works well together with the Category page template (m4_catalog_category_page.tpl).

 

 

Use this snippet, to show the button for the category with ID = 11 only

{if $HOOK_M4_PDF_CATEGORY && $id_category == 11}{$HOOK_M4_PDF_CATEGORY}{/if}

Share this post


Link to post
Share on other sites

Thx, but I wanted to get something else.

I want to send a link to the price list automatically generated to prices and inventory were still active.
After clicking per customer on the link should generate a link to a product in a particular category.

Share this post


Link to post
Share on other sites

Do you mean to create a product link in the catalog? Like this:

<a href="{$link->getProductLink($product[products].id_product)|escape:'html':'UTF-8'}" style="text-decoration: none; color: black;">
    {$product[products].name|escape:'htmlall':'UTF-8'}<tocentry content="{$product[products].name|escape:'htmlall':'UTF-8'}" level="0" />
</a>

Share this post


Link to post
Share on other sites

I have create link to catalog - all products fom category id=11 ( example ) - pricelist products for customer

Edited by And63 (see edit history)

Share this post


Link to post
Share on other sites

Ok. thanks, but, if I use this code:

{if $HOOK_M4_PDF_CATEGORY && $id_category == 11}{$HOOK_M4_PDF_CATEGORY}{/if}

Button display on site category id=11 -its right.

But, if I click it - module generate catalog all products in shop.

How generate catalog only products where it id category default =11 ?

Share this post


Link to post
Share on other sites

You are right. It is a bug. Please change

<input type="hidden" name="categoryBox[]"

to

<input type="hidden" name="category_box[]"

in m4pdf.php. The next version will fix it.

Share this post


Link to post
Share on other sites

Is there any manual on how to update this module?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hello Tuk66 i have buy your module but i need a customization to my m4_invoice_2.tpl. Please note that my m4_invoice_2.tpl is already customized so i need that you work on my version of this file.

You have an email where i can send example file and tpl to customize?

I want also pay for your help, please let me know

Have a nice day

Share this post


Link to post
Share on other sites

Hi and thanks. Please use the chat at www.presta-addons.com.

Share this post


Link to post
Share on other sites

Thanks for info..

 

And what about supplier info in invoice? Is it possible to print out product supplier name, logo, address, phone and description? 

 

For example with:

$supplier->name

$supplier_address->address1

etc...

Share this post


Link to post
Share on other sites

Using static function Supplier::getNameById($id_supplier), you can show the name this way
 

{assign var="supplier_name" value=Supplier::getNameById($order[orders].id_supplier)}
{$supplier_name|escape:'htmlall':'UTF-8'}

 

  • Like 1

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.1 (2015-04-23)
- Added displaing memory and time required to generate PDF (debug mode in module administration)
- Added CSS styles for the Table of Contents (catalog templates only)
- Fixed selecting a category for printing the catalog on category page
- Fixed "Template description not correct" when you save template in the online editor (rarely in PHP 5.3 and earlier versions)

  • Like 1

Share this post


Link to post
Share on other sites

Hello M4,

 

Please can you confirm me that the calculation of creditslip will be correct on prestashop 1.6.0.14 with your module ? as for now prestashop 1.6.0.14 credit slip isn't right the credit slip don't have the same price as the order invoice and tax.

 

Regards,

Share this post


Link to post
Share on other sites

Yes, I can confirm that credit slip in 1.6.0.12 - 1.6.0.14 is completely wrong. The problem is with database, amounts are wrongly calculated. The root of all problems is in /classes/order/OrderSlip.php file.

 

I did a quick and dirty test. Just tried to replace that file with the older version - from v1.6.0.11. I didn't study all changes in that file, so please be very CAREFULL. It probably doesn't work in all cases.

 

I returned all goods and repaid shipping costs. See the invoice as well as credit slip created by this module and compare with the original credit slip (wrong tax breakdown).

original-creditslip.pdf

m4pdf-creditslip.pdf

m4pdf-invoice.pdf

Share this post


Link to post
Share on other sites

Hi ,
im thinking to buy this module.
How can i add

Order time on invoice ? i want to add :
 

Invoice Number xxxxxxx
Date of İnvoice  2014-12-03
Time :11:11
Shipping Date : 
 

Share this post


Link to post
Share on other sites

Use this

{$order[orders].invoice_date|date_format:"%R"}

Share this post


Link to post
Share on other sites

I'm a new user of m4 pdf

I have a problem we use a lot the invoice_note field for printing serial numbers and other legal txt on the invoice.
I don't see how i can add the invoice_note field to the m4pdf template.
 

Share this post


Link to post
Share on other sites

You can retrieve the note of the first invoice (and almost alone) this way:

{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}
    <div class="clear">{l s='Note:' mod='m4pdf'} {$note|escape:'htmlall':'UTF-8'|nl2br}</div>
{/if}
Edited by tuk66 (see edit history)

Share this post


Link to post
Share on other sites
<div class="clear-right w30 border right align-center bigger bold">
        {l s='Total:' mod='m4pdf'} {displayPrice price=$order[orders].total_paid currency=$order[orders].id_currency}
    </div>
 
{factory assign="order" class="Order" id=$order[orders].id_order id_lang=$m4_actual_language}
{if is_object($order)}
    {assign var="note" value=$order->getInvoicesCollection()->getFirst()->note}
    {l s='Note:' mod='m4pdf'} {$note|escape:'htmlall':'UTF-8'|nl2br}
{/if}
 
 
    <!-- start private messages block -->
    {if !empty($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}
 
{else}

I have add the code just before the private message block, but the note content from table order_invoice->note is not showing on the invoice?

 

Share this post


Link to post
Share on other sites

Question: I am not the goddess of coding :rolleyes:  In fact I am rather an amateur. I was hoping my skills would be enought to fiddle with the template layouts but I notice that I just don't know enough html / css to tweak the invoice layout that it will match my idea of how it should look like  (and the swedish tax agencies guidelines what an invoice needs to include).

 

Is there a way to c&p the template code of a sample invoice and export that to some visual editor where I can move the elements around like I want them to and the code adjust itself ?

 

Or will this ruin everything ?

 

Regards,

Jennifer

Share this post


Link to post
Share on other sites

There is no visual editor, just online code/text editor.

Share this post


Link to post
Share on other sites

I think I found a bug!

 

When creating credit slips, the product is shown 3 times - but only when using taxes.

Credit slips without taxes are fine.

 

PrestaShop internals Credit Slip does it correctly, I even checked the database (order_slip_detail) manually to confirm the product is there only once, so I can track it down to M4PDF.

 

Any idea?

 

Thanks :)

Share this post


Link to post
Share on other sites

Send me details by mail and I will look at it immediately - module version, PrestaShop version, template used, Debug template HTML output to see raw data and any other important information.

Share this post


Link to post
Share on other sites
I resolved it!

 

It turned out that PrestaShop somehow tripled the ps_order_detail_tax

entries when I upgraded from 1.5 to 1.6!

 

I now removed the duplicates and all is working well.

 

Internal PrestaShop credit slips were affected differently than M4, it seems.

 

It's working now and wasn't an M4 Bug :)

Share this post


Link to post
Share on other sites
<div class="clear-right w30 border right align-center bigger bold">
        {l s='Total:' mod='m4pdf'} {displayPrice price=$order[orders].total_paid currency=$order[orders].id_currency}
    </div>
 
{factory assign="order" class="Order" id=$order[orders].id_order id_lang=$m4_actual_language}
{if is_object($order)}
    {assign var="note" value=$order->getInvoicesCollection()->getFirst()->note}
    {l s='Note:' mod='m4pdf'} {$note|escape:'htmlall':'UTF-8'|nl2br}
{/if}
 
 
    <!-- start private messages block -->
    {if !empty($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}
 
{else}

I have add the code just before the private message block, but the note content from table order_invoice->note is not showing on the invoice?

 

The snippet wasn't quite right. I fixed it. For the order, id_lang=$m4_actual_language part is wrong.

Share this post


Link to post
Share on other sites

HOW TO incorporate a CMS page in invoice - for example Terms and conditions (Hamon Law)

 

Let's say we have the Terms and conditions CMS page with ID = 3. We can use this snippet to show these terms on a new page:

{factory assign=cms class="CMS" id_lang=$m4_actual_language id=3}
{if is_object($cms)}
    <pagebreak />
    {$cms->content}
{/if}

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.2 (2015-05-26)
- Support for classes of the other modules (Installation tab) *
- Support for multiple languages in a single template. Any text can include an optional Language parameter (ID or ISO).
  examples: {l s='text to translate' lang=3 mod='m4pdf'}, {l s='text to translate' lang=fr mod='m4pdf'}
- New template "Orders - preview" showing a comprehensive overview of the order

 

* Using static functions (example): http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/?view=findpost&p=1668332

Share this post


Link to post
Share on other sites

Hello,

 

I tried to override the default invoice that was sent via attachment when customer place order, but even I checked the Invoice via email and selecting my template, it still send out the original one, please help....

Share this post


Link to post
Share on other sites

It means the module is not properly installed. Note down your settings, uninstall the module and install again.

 

After successfull installation, you will have

 

  'PDF' =>
  array (
    'path' => 'override/classes/pdf/PDF.php',
    'type' => 'class',
    'override' => false,
  ),

 

in /cache/class_index.php.

Edited by tuk66 (see edit history)

Share this post


Link to post
Share on other sites

It means the module is not properly installed. Note down your settings, uninstall the module and install again.

 

After successfull installation, you will have

 

  'PDF' =>

  array (

    'path' => 'override/classes/pdf/PDF.php',

    'type' => 'class',

    'override' => false,

  ),

 

in /cache/class_index.php.

I tried to re-install but still no "override/classes/pdf/PDF.php'" in class_index.php

 

and I tried to edit the file manually then it leads to a blank home page.....

Share this post


Link to post
Share on other sites

PM me. I will do it. Unforunately, some PrestaShop versions regularly fail to install some modules.

Share this post


Link to post
Share on other sites

I'm trying to produce a catalog organized by category, and would like to have a category image before the products for that category are listed.

 

I have no trouble getting the category name & description, but can't get the id_image through a product's default_category.

Share this post


Link to post
Share on other sites

PM me. I will do it. Unforunately, some PrestaShop versions regularly fail to install some modules.

Hello,

 

I PMed you could you please help?

Share this post


Link to post
Share on other sites

Ok. thanks, but, if I use this code:

{if $HOOK_M4_PDF_CATEGORY && $id_category == 11}{$HOOK_M4_PDF_CATEGORY}{/if}
You are right. It is a bug. Please change
<input type="hidden" name="categoryBox[]"
to
<input type="hidden" name="category_box[]"
in m4pdf.php. The next version will fix it. 

Button display on site category id=11 -its right.

But, if I click it - module generate catalog all products in shop.

How generate catalog only products where it id category default =11 ?

 

How generate product catalog which would only products marked as active.

On this moment is generate catalog witch all products - active and non active.

Share this post


Link to post
Share on other sites