News:

Looking for documentation? Take a look on our wiki

Main Menu

Testing and debugging the invoice

Started by Kuubs, January 31, 2020, 16:49:26 PM

Previous topic - Next topic

Kuubs

Hello,

Looking at this page (https://docs.virtuemart.net/manual/general-concepts/205-invoices.html) it's possible to see the output of the invoice from every order so I can more easily debug and test the output of the invoice (instead of making a new order constantly). Unfortunately, the docs seem outdated, I don't get the view out of it.

Does someone know the correct working link for this? I want to see the invoice in plain html, see the mail invoice etc.

This does not work:

/index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=7

or

/index.php?option=com_virtuemart&view=invoice&layout=mail&tmpl=component&virtuemart_order_id=7


Also when I check my url it seems different, and calls a task:

/index.php?option=com_virtuemart&view=orders&task=callInvoiceView&tmpl=component&virtuemart_order_id=7&layout=invoice

Anyone know the correct url?

GJC Web Design

no idea .. I just put die(); at the end of the invoice default template and toggle the status -- there's your complete html invoice
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

Quote from: GJC Web Design on January 31, 2020, 17:26:04 PM
no idea .. I just put die(); at the end of the invoice default template and toggle the status -- there's your complete html invoice

Ah ok thank you, I'll check it out to see if that works for me. Does that mean that the email does not get sent or anything?

GJC Web Design

just use a previously confirmed order with invoice, delete the invoice from your safe path folder invoices and click the invoice view icon on the order
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

Quote from: GJC Web Design on February 02, 2020, 13:06:32 PM
just use a previously confirmed order with invoice, delete the invoice from your safe path folder invoices and click the invoice view icon on the order

CanI also debug the email templates with this method?

GJC Web Design

yes.. die() the default but there is already an admin setting for email debugging
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

Quote from: GJC Web Design on February 02, 2020, 16:26:41 PM
yes.. die() the default but there is already an admin setting for email debugging

Could you tel me where? Because I saw tha you can use a certain link, but that is not working anymore with the newest VM

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

How can I debug the PDF invoice? I tried add die() at the end but it still generates the PDF instead of displaying the HTML first...

GJC Web Design

Quotejust use a previously confirmed order with invoice, delete the invoice from your safe path folder invoices
!!!
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

Quote from: GJC Web Design on February 06, 2020, 11:54:14 AM
Quotejust use a previously confirmed order with invoice, delete the invoice from your safe path folder invoices
!!!

I understand that but is it possible to get the HTML first? That is easier debugging for me instead of checking the PDF constantly

GJC Web Design

it does stop on the html if u have the die() in the correct file

templates\xxxx\html\com_virtuemart\invoice\invoice.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

Quote from: GJC Web Design on February 06, 2020, 12:59:32 PM
it does stop on the html if u have the die() in the correct file

templates\xxxx\html\com_virtuemart\invoice\invoice.php

That is weird, because I have that in my file, except it just starts the download...

Kuubs

#13
Ok I think I have to just download the invoice over and over again. No big deal. But the problem lies in the fact that I can't seem to make the invoice totally blank. It keeps printing the line above and below the page, and also the vendor's logo. How can I amke the PDF totally blank?


Found it, it's in the Store page and then Templating/Invoices where you can disbale the lines and header.

derek webster

Not sure if this helps anyone but I think I figured it out witn the following
just need to change the header
This lets me see the PDF in browser instead of downloading

hope it helps!!

components/com_virtuemart/controllers/invoice.php
replace these lines
$contentDisposition = 'attachment';
with
$contentDisposition = 'inline';

Oh And possibly change th path here
return VmPdf::createVmPdf($view, $path, 'F', $metadata);
to
return VmPdf::createVmPdf($view, $path.'test', 'F', $metadata);

this lets you refresh in the browser and see any changes

I found solution here
https://stackoverflow.com/questions/6293893/how-do-i-force-files-to-open-in-the-browser-instead-of-downloading-pdf