VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: gba on September 20, 2016, 14:03:52 PM

Title: [solved] Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 20, 2016, 14:03:52 PM
Hi all!

These days I updated my online shop to VM v3.0.17 and Joomla 3.6.2.
I just noticed, that the source code of emails on changed order status is broken now:
There are line breaks in the email's source code, where in the template files are none.

This has not been in v3.0.12 with Joomla 3.4.8.

Can anyone confirm this?
And does anyone know, how to fix this?

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 20, 2016, 14:18:16 PM
VM v3.0.17 is very old

try 3.0.18 http://dev.virtuemart.net/projects/virtuemart/files
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 20, 2016, 18:07:59 PM
Hi!

Thank you for your reply.

I updated VM now - neither 3.0.17.6 nor 3.0.18 have this issue fixed.
Anyone any other idea?

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: jenkinhill on September 20, 2016, 18:38:29 PM
I don't have a problem with 3.0.17.6 or 3.0.18 - can you post an example?
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 20, 2016, 19:15:37 PM
Hi!

Attached please find the source code of such a broken email.

Kind reagards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 20, 2016, 21:50:34 PM
I agree your attached .txt is full of line feeds and breaks but if you look directly at the template files

e.g. components\com_virtuemart\views\invoice\tmpl\mail_html.php they are fine from VM

Are u over riding them or have you tried replacing directly with ftp?
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 20, 2016, 22:18:39 PM
Hi!

Neither I am overriding them, nor I have tried to replace them directly with FTP.
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: jjk on September 20, 2016, 23:32:49 PM
Looks to me like you had opened and saved the file with a word processor. Many lines show the Windows 'End of Line' (EOL) type instead of Unix EOL type. So instead of 'LF' you have 'CR LF'. Also, if this is the complete source code of the email, I think it should show the DOCTYPE information in the first few lines. Maybe you just have to switch your browser 'View' > 'Text Encoding' to unicode encoding instead of western.
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 22, 2016, 12:54:03 PM
Hi jjk!

Thank you for your input.
Actually the template files do have just LF as end of line. There is no difference to another clear VM3.0.18 full package installation, where the emails are not broken. And also in the non broken emails the ends of line are CRLF then.
In both installations there is not DOCTYPE information in the first few lines.
So I still need to know, what is the difference between my installation and the full package installation.

Anymore ideas anyone?

Kind regards,
Gerald

EDIT: Sorry, I just noticed the CRLFs in my 'email.txt' file, while the regular line breaks are just LFs. So where do these additional CRLFs come from?
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 22, 2016, 13:14:25 PM
Quotenor I have tried to replace them directly with FTP.

why not?.. seems the first thing to try...
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 22, 2016, 13:30:33 PM
Do I understand you right, that you advise me to replace the VM template files in '/components/com_virtuemart/views/invoice/tmpl/' via FTP?
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 22, 2016, 14:11:37 PM
yes.. if u aren't using over rides

unpack  http://dev.virtuemart.net/attachments/download/1020/com_virtuemart.3.0.18.zip
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 22, 2016, 14:26:37 PM
Hi all!

I just found some difference between my updated installation and the clear full installation:
The emails of the full package installation have CRLFs where the template files have LFs.
The emails of my updated installation have LFs where the template files have LFs and additionally CRLFs approximately every 70 characters.
So this question arises:
Why are the LFs not replaced by CRLFs in my updated installation?

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 22, 2016, 14:44:29 PM
so which works correctly..?

the fact is no one else is reporting problems
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 22, 2016, 14:49:37 PM
In my opinion the emails of the full package installation are alright.
To answer your question: I think, the clear full package installation works correctly.

The fact, that no one else is reporting that problem, certainly does not solve the problem with me  ;)
Actually the clear full package installation works fine.
I am asking the forum hoping, that someone could help me find the source of the issue I am facing in my updated installation.
So I am grateful to anyone, who will do that.

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 22, 2016, 15:14:00 PM
I've said it before.. simply replace the files
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 22, 2016, 15:28:18 PM
I did replace the files - nothing changed.

Quote from: gba on September 22, 2016, 14:26:37 PM
Why are the LFs not replaced by CRLFs in my updated installation?
I am assuming, that during email body generation no CRLF is found in the source code as there are LFs, only. So the body content is stripped by CRLFs.
The right behaviour would be, that the LFs of the template files are replaced by CRLFs. This way the clear full package installation seems to work.

So, at which place in the VM source code the LFs of the template files should be replaced with CRLFs for the email body?
Maybe I can find the source of the issue in my updated installation in this direction...

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 22, 2016, 15:39:16 PM
no where afaik - its just a simple template

emails are produced in the VM FE helpers/shopfunctionsf.php
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: Milbo on September 22, 2016, 15:49:11 PM
I think you use a template override for the emails.
Or you edited the file per ftp and so the updater was not able to override the files.

The emails are generated in shopfunctionsf, but use for rendering "normal" views.
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 22, 2016, 15:59:25 PM
Hi!

Thank you for your dedication to this thread.

Above I already stated, that I am using no overrides. For this reason I actually do get emails in VM native layout - just broken, due to the LFs in the email body.
And I did not edit any VM template file. Furthermore to be totally sure I even renamed the 'tmpl' directory and uploaded the original 'tmpl' directory from the VM 3.0.18 core pack via FTP. So the template files really should be virgin :)

Please help me to find out, why the LFs remain in the email body, although they should be CRLFs.

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 27, 2016, 15:01:36 PM
*Urgent push*
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: GJC Web Design on September 27, 2016, 15:54:40 PM
I think your being unrealistic here.. no one else reports this problem so by definition the problem is yours...

We have suggested all we can think of .. next step is if u don't have the skills to go further you employ someone who has.. 
What other help apart from all the above do u expect to receive ?  We don't know what the problem is on your install.

Maybe someone else knows...
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: jenkinhill on September 27, 2016, 16:48:18 PM
Answers are usually forthcoming if somebody else has seen the same issue - if we have never seen it on one of ours or a client's site then we cannot advise.
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 27, 2016, 17:19:18 PM
Hi!

Thank you for your good will.
I already opened a VM ticket to get paid help on this issue - but I did not get it there. So I hoped, someone here in the forum could help me.

In the meanwhile I found out, that the text, I stored in email footer field of VM vendor ("vendor_letter_footer_html" in option=com_virtuemart&view=user&task=editshop) is returned with "
"s instead of LFs. This seems to break the whole thing.
My workaround:
Before I echo the email footer text in the mail_html_footer.php file, I replace all "
"s with "\n"s:$ftrHTML = $this->replaceVendorFields($this->vendor->vendor_letter_footer_html, $this->vendor);
$ftrHTML = str_replace('
',"\n",$ftrHTML);
echo $ftrHTML;
This way the order email sourcecode comes out allright.

What I still don't know is:
Why does $this->replaceVendorFields($this->vendor->vendor_letter_footer_html, $this->vendor) return a string containing these "
"s in my updated installation, and with VM 3.0.12 it did not?

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 29, 2016, 10:52:47 AM
Hi!

I think I found the problem now:
I had prepared some HTML code for the invoice/e-mail footer and copied that code to the vendor_letter_footer_html field.
That seems to cause some crash in VM - also in the clear fullpackage installation.
And there is no matter, if the lines end with CRLF or just with LF in the code editor (in my case NP++).
VM really should not crash, just because the user pastes texts into its fields.

Kind regards,
Gerald
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: Milbo on September 29, 2016, 13:03:29 PM
Quote from: gba on September 27, 2016, 17:19:18 PM
I already opened a VM ticket to get paid help on this issue - but I did not get it there. So I hoped, someone here in the forum could help me.
This is not true. I just directly said it will cost per hour and there is no guarantee that I find the reason and that I anyway answer here in the forum for free, when I have an idea.

And the problem with your pasted text is the configuration of the editor. The editor changes it. You need to adust ist there. You did not write that you enabled the html mode in the editor, you did not mention your editor, and you did not mention the rights, which you used to edit it. All of that can change how html chars are handled.

It also does not crash vm, else there wouldnt be any email.
Title: Re: Email source code broken in v3.0.17 with Joomla 3.6.2
Post by: gba on September 29, 2016, 13:22:41 PM
Hi Max!

QuoteThis is not true. I just directly said it will cost per hour and there is no guarantee that I find the reason and that I anyway answer here in the forum for free, when I have an idea.
No reason for blasting!
GJC wrote
Quote.. next step is if u don't have the skills to go further you employ someone who has..
and I just wrote, that I've already asked for paid support - I have no problem with that. Although asking for paid support more than a week ago actually no one had a look at my installation. Maybe you want to check our chat a little bit closer  ;)

QuoteAnd the probelm with your pasted text is the configuration of the editor.
I actually have no editor activated - so the blank HTML code is pasted and stored in the field mentioned.

Although I am not paid for testing and debugging VM, I am still prepared to give constructive input, if there would be something, that could be improved in VM.

Kind regards,
Gerald