News:

Looking for documentation? Take a look on our wiki

Main Menu

Override of confirmation mails

Started by sscheidegger, February 29, 2012, 18:05:33 PM

Previous topic - Next topic

Thomas Kuschel

Hi,
I put the views to the invoice into my joomla template, but it didn't work too. (/template/mytemplate/html/com_virtuemart/invoice/*.php); all other com_virutuemart views did work
So, after debugging, I found out that within the function "renderMail" the origin path to the /view/$viewName/tmpl/ is added as LIFO, even though the path already exists!!! -  so the template path wasn't found any more.

I have commented out the line 180 in /components/com_virtuemart/helpers/shopfunctionsf.php (line 180):
//Todo, do we need that? refering to http://forum.virtuemart.net/index.php?topic=96318.msg317277#msg317277
//TK 20120309 LOYTEC patch next line: we do not need the template loaded - because of LIFO, the default user template is overwritten.
//$view->addTemplatePath(JPATH_VM_SITE.'/views/'.$viewName.'/tmpl');


Please check this out! -
now it works for me, and I can change all the invoice - mail stuff in my template!

Thomas Kuschel

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ZX81


maxispin

#18
Quote from: tkuschel on March 13, 2012, 16:56:28 PM
now it works for me, and I can change all the invoice - mail stuff in my template!

Thanks Thomas!  and also Sscheidegger in page 1 !!

Milbo,
The problem what still exists is that the status update and invoice email are the same. They should be two different things. Please separate them.


I tried to figure out a if-clause in mail.html.php without success  :( - skills just aren't nearly there.. (e.g., order already exists, do not print pricelist)


// render price list
         
foreach ($this->orders['fields'] as $field) {
        if ($field['value'] < 0 ) {
echo $this->loadTemplate('pricelist');
}}
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

Lexiboy

Quote from: tkuschel on March 13, 2012, 16:56:28 PM
Hi,
I put the views to the invoice into my joomla template, but it didn't work too. (/template/mytemplate/html/com_virtuemart/invoice/*.php); all other com_virutuemart views did work
So, after debugging, I found out that within the function "renderMail" the origin path to the /view/$viewName/tmpl/ is added as LIFO, even though the path already exists!!! -  so the template path wasn't found any more.

I have commented out the line 180 in /components/com_virtuemart/helpers/shopfunctionsf.php (line 180):
//Todo, do we need that? refering to http://forum.virtuemart.net/index.php?topic=96318.msg317277#msg317277
//TK 20120309 LOYTEC patch next line: we do not need the template loaded - because of LIFO, the default user template is overwritten.
//$view->addTemplatePath(JPATH_VM_SITE.'/views/'.$viewName.'/tmpl');


Please check this out! -
now it works for me, and I can change all the invoice - mail stuff in my template!

Thomas Kuschel

After commenting this out the new order notifications use the templates in /templates/...., which is great.

But when I update an order's status and Joomla wants to send the mail of order status change it complains it cannot find the mail_html view... What to do...
With kind regards,
Alex Stienstra

baroen

I am having the same problem. Being on v2.0.6 I took the original invoice files, modified them and saved them in my template/html/invoice folder. When generating an invoice VM still uses the original layout. I tried to comment out the '180' line, but that did not work either. How can I get VM to use my own invoice layout? Any solutions yet?

Thomas Kuschel

With VM 2.0.6 this behavior is already fixed. Be careful to copy the right files/directories!
I copied only the files mail_html.php, mail_html_footer.php, mail_html_header.php, mail_html_pricelist.php, mail_html_shopper.php, mail_html_shopperaddresses.php, mail_html_vendor.php, and the index.html into the folder
templates/<mytemplate>/html/com_virtuemart/invoice/
The mailing (Order Mail Format) was configured to "HTML Mail".
It does work!

Thomas
http://www.loytec.com

reinhold

This line is needed in the invoice.php controller when the pdf invoice is automatically created (i.e. when VirtueMartControllerInvoice::checkStoreInvoice creates the pdf), because there the whole virtuemart path environment doesn't seem to be set up properly. And this does not appear to be fixed in Virtuemart 2.0.12f.

If you view the invoice pdf in the backend by clicking on the invoice icon, then a completely different codepath is used to create the pdf (joomla's pdf generation functionality, together with the invoice/mail_html view template.
If the order status is changed to a value configured to auto-generate and send the invoice, then

Basically, the templates used are:

-) notification mail body: mail_html.php
-) pdf invoice in the "order" list in the BE (click on the pdf icon): invoice.php
-) print invoice in the "order" list in the BE (click on the print icon): invoice.php (but no header/footer!)
-) auto-generated pdf invoice mail body (change the order status to confirmed): mail_html.php (but NO language override)
-) auto-generated pdf invoice mail attachment (change the order status to confirmed): invoice.php (but NO language override)

So, to me it seems like the invoice generation uses different codepathes and different templates, which might run you into legal trouble, if you forget to modify one template. Then a different invoice might be mailed out to the customer than you print out for your own bookkeeping in the backend!


randomdev

#23
Quote from: reinhold on November 21, 2012, 19:19:25 PM
This line is needed in the invoice.php controller when the pdf invoice is automatically created (i.e. when VirtueMartControllerInvoice::checkStoreInvoice creates the pdf), because there the whole virtuemart path environment doesn't seem to be set up properly. And this does not appear to be fixed in Virtuemart 2.0.12f.

So, to me it seems like the invoice generation uses different codepathes and different templates, which might run you into legal trouble, if you forget to modify one template. Then a different invoice might be mailed out to the customer than you print out for your own bookkeeping in the backend!

I may have missed it but I cannot see the line you are talking about for invoice.php?

I have made an override for invoice_items.php which I thought invoice.php was using for the pdf attachment to customer but I am getting a layout with a discount column that I had removed?

Is it the case that the pdf attachment to the customer is simply not using the overrides? (I am using vm 2.0.14)

Milbo

Quote from: reinhold on November 21, 2012, 19:19:25 PM
If you view the invoice pdf in the backend by clicking on the invoice icon, then a completely different codepath is used to create the pdf (joomla's pdf generation functionality, together with the invoice/mail_html view template.
...
So, to me it seems like the invoice generation uses different codepathes and different templates, which might run you into legal trouble, if you forget to modify one template. Then a different invoice might be mailed out to the customer than you print out for your own bookkeeping in the backend!


Completly wrong! ! !

The path for the invoice/order print in the BE is "https://yourdomain.com/index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&virtuemart_order_id=16&order_number=6e2e018&order_pass=p_6f8d5"

Clearly to see that it is pointing to the FE. There is NO invoice/order or any mail layout in the BE. You can override all with the FE template. Also a thread I should have deleted, because you answer to a problem which was solved in 2.0.6

Maybe you have old layouts of an old version there, but there is NO file with "invoice" in the name in the whole BE, it does not exist.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

neo314

Quote from: Milbo on December 17, 2012, 11:45:20 AM
Quote from: reinhold on November 21, 2012, 19:19:25 PM
If you view the invoice pdf in the backend by clicking on the invoice icon, then a completely different codepath is used to create the pdf (joomla's pdf generation functionality, [snip]
Completly wrong! ! !

[snip]

Maybe you have old layouts of an old version there, but there is NO file with "invoice" in the name in the whole BE, it does not exist.

Hi Milbo,

I don't think he was saying the file was in the BE. I think he was just identifying which file the BE pdf link was using, and as discussed in the other thread, the PDF files are different, so something is different.

I appreciate how many questions that seem to already be answered are asked again and how many users may be off base on how VM works. I really appreciate all the work you have put into this. At the same time, this invoice issue is a serious matter, and your responses on this subject, at times, seem defensive, dismissive, and abrupt. I don't think people are complaining. We just want to figure this out.

Milbo

I just explained it reinhold 2 days ago.

Joomla stopped pdf support. So we just take the same library (but updated) and install it with the aio at the same place. To create a pdf out of a product view or similar, we use the joomla pattern which is just using view.pdf.php instead of the view.html.php.

But then we cannot store it on the disc, what we need to send it per email. That is the reason that it is slightly different. But usually a store is using only email, or only print. Therefore it is usually not a problem.

Furthermore for the state it is unimportant, so it s a cosmetic problem. Then ask your users if they even noticed the difference between the pdf of the mail and the printed invoice. Of course, we are happy if someone is enhancing it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

neo314

Quote from: Milbo on December 19, 2012, 23:46:55 PM
I just explained it reinhold 2 days ago.

Joomla stopped pdf support. So we just take the same library (but updated) and install it with the aio at the same place. To create a pdf out of a product view or similar, we use the joomla pattern which is just using view.pdf.php instead of the view.html.php.

But then we cannot store it on the disc, what we need to send it per email. That is the reason that it is slightly different. But usually a store is using only email, or only print. Therefore it is usually not a problem.

Furthermore for the state it is unimportant, so it s a cosmetic problem. Then ask your users if they even noticed the difference between the pdf of the mail and the printed invoice. Of course, we are happy if someone is enhancing it.

Hi Milbo,

I have followed the dialog, unless there is a thread I have not found yet on this subject, and I believe I understand what you are explaining.

I disagree that this is merely a cosmetic problem, but if that were the case, a cosmetic problem like this is still a problem. It is like having a crappy business card.

I don't think it is purely cosmetic either. The Email that I get from the purchase is something I can override, and even without doing an override, it is not coming from the same source as the attached PDF file. The email has clean formatting with order information at the top and the Bill To/ Ship To list the information cleanly with out the array's keys spit out.

The pdf attached to the email and the pdf shown in the back end, may share a source file, but template overrides appear in the BE pdf and not in the email attachment pdf, and on mine, the head of the two files is different along with added information (Order Status Table) included in the email attachment (See attached images).

I need to be able to get control of this layout to move forward. If the email does not match the pdf, I at least need to be able to make the BE pdf and the email attachment pdf match. If I can't do that, as a last resort, I need to at least be able to stop the email attachment from going out (just the email, no attachment).





[attachment cleanup by admin]

neo314

#28
For anyone this may help, this thread provided me my last resort solution. http://forum.virtuemart.net/index.php?topic=110099.0

I would like to be able to attach a decent pdf invoice for the customer, but until that is possible, the email will have to do.

As a feature request, should the override/styling capability for the email pdf attachment issue get resolved, it would be nice if the filename prefix were configureable so that instead of vminvoice_ it could be MyStoreInvoice_ and even better if I could configure the pattern so I could get MyStoreInvoice_12-19-2012_[order number] or whatever.

Something like this in the BE configuration (| xxx | represents what would be inside the input field):

Invoice Prefix: | vminvoice_ | [default]
Invoice Number Date Format: | ymd | Hint: code for PHP date function date("ymd") [default]

(P.S. I saw that it looks like that is not how you are getting the date format so I don't know what would work better. That is just supposed to be what would be included in the php date function for output)

randomdev

If you want to change it I believe the filename is in controllers/invoice.php line 88 (I haven't tested this)

$path .= 'vminvoice_'.$invoiceNumber.'.pdf';