VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sirius on September 10, 2021, 14:43:21 PM

Title: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: sirius on September 10, 2021, 14:43:21 PM
Hello,

when we upgrade to JCE 2.9.12+, our custom fields set to editor, do not show the editor anymore.

Ryan, owner of JCE, explained to me what is going on :

Quote from: Ryan DemmerThe issue is caused by some javascript in Virtuemart, which attempts to create a new editor instance, before all javascript (including JCE javascript) has loaded on the page, ie:

<script type="text/javascript">// Creates a new editor instance
    tinymce.execCommand("mceAddControl",true,"field-15-customfield_value")
</script>

Quote from: Ryan Demmer
This script is in administrator/components/com_virtuemart/models/customfields.php on line 788

The reason this happens with JCE Pro 2.9.12+ and not JCE Pro 2.9.11, is that the way the javascript is loaded in 2.9.12+ was changed for Joomla 4 compatability. Nevertheless, Virtuemart should not try an execute a javascript function until it is sure that javascript function has actually loaded!

Until Virtuemart fixes this (you might want to inform them of the issue), you will need to use JCE Pro 2.9.11

Thanks in advance
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Milbo on October 28, 2021, 11:08:38 AM
Please test https://dev.virtuemart.net/attachments/1291/com_virtuemart.3.8.9.10557_package_or_extract.zip
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: sirius on October 29, 2021, 19:11:09 PM
Thanks Milbo, I'll test ASAP
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: sirius on January 01, 2022, 15:47:31 PM
Quote from: Milbo on October 28, 2021, 11:08:38 AM
Please test https://dev.virtuemart.net/attachments/1291/com_virtuemart.3.8.9.10557_package_or_extract.zip

Hi Milbo

just tested the 10564 package:
http://dev.virtuemart.net/attachments/1295/com_virtuemart.3.8.9.10564_package_or_extract.zip

But now I got no editor at all on my custom-field
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: sirius on February 03, 2022, 11:06:42 AM
Hi
Same issue with package 3.8.9.10583
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: sirius on February 21, 2022, 10:15:20 AM
Hi,
same issue with 3.8.9.10591
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Rune Rasmussen on August 30, 2022, 14:32:50 PM
And same issue on VirtueMart 4.0.2 10661 and Joomla 3.10.11  :'(
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Jumbo! on August 30, 2022, 16:35:20 PM
Try this.

Open - administrator/components/com_virtuemart/models/customfields.php

Find the following codes between lines 859 to 860:

vmJsApi::addJScript('mceAddControl', '// Creates a new editor instance
tinymce.execCommand("mceAddControl",true,"field-' . $row . '-customfield_value")', true);


Replace the above by:

vmJsApi::addJScript('mceAddControl-' . $row, 'tinymce.execCommand("mceAddControl", true, "field-' . $row . '-customfield_value");', true, false, true);

This should resolve the issue.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Rune Rasmussen on August 30, 2022, 17:01:38 PM
Thanks Jumbo!

That works nicely. Lets hope it can get fixed in VM core some day too.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Studio 42 on August 30, 2022, 18:56:17 PM
The best way is to use Joomla standard function, so you can use any editors
See https://joomla.stackexchange.com/questions/28971/display-an-editor-in-the-front-end-using-a-module
or
https://joomla.stackexchange.com/questions/31473/how-to-properly-display-editor-instance-in-joomla-4
Hte only problem is with ajax loading perhaps
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Milbo on August 30, 2022, 23:42:16 PM
Added, sorry guys, but I cannot fix anything. VirtueMart is a opensource project and relies on the work of people volunteers in the forum. Thank you Abhishek, added to the core.

Btw, I did not test if it works on j3 and j4.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Milbo on August 30, 2022, 23:44:21 PM
Patrick, if you provide the code, I think anyone agrees that we add it.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Mike J on August 31, 2022, 03:04:35 AM
Quote from: Milbo on August 30, 2022, 23:42:16 PMI cannot fix anything. VirtueMart is a opensource project and relies on the work of people volunteers in the forum.

Hello Max,

Welcome back. I trust that you had a great time away.

Some hard-working volunteers on the forum have made some useful points about the decreased reputation and reliability of VM over the last 6-8 weeks.

I'm not sure how VM is set up. If you're the CEO, or chief programmer, coder or owner... But it appears that you're the face and future of VM (Certainly, when you're away, nothing happens).

... As it's open source, would you consider delegating and/or training up some of these guys, who really do have VMs best interests at heart, to help steer the ship next time you're away?

It would mean releasing some control... Handing over some keys... You may not want to do this, but I'll throw the idea out there not to be popular but because I believe actioned, this suggestion would greatly benefit all attached to the VM project.

TEAM = Together, Everyone, Achieves, More.

Again, it's great to have you back.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Jumbo! on August 31, 2022, 07:51:22 AM
Quote from: Milbo on August 30, 2022, 23:42:16 PM
Thank you Abhishek, added to the core.

Btw, I did not test if it works on j3 and j4.

I have tested it. It works fine both on Joomla 3 and Joomla 4.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Studio 42 on September 01, 2022, 23:25:18 PM
Max, I've already posted bugs and fixes for the last few months and haven't heard back.
I don't waste time for nothing.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Rune Rasmussen on September 05, 2022, 09:58:09 AM
Quote from: Milbo on August 30, 2022, 23:42:16 PM
sorry guys, but I cannot fix anything. VirtueMart is a opensource project and relies on the work of people volunteers in the forum.

So VirtueMart doesn't have a core team or lead developer anymore? That's indeed interesting and good to know when planning for the future, so thanks for letting us know.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: GJC Web Design on September 05, 2022, 20:16:45 PM
Max means "everything"  .. instead of "anything"  -  typo

He is suggesting if someone fixes this the code will be accepted for the core
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Milbo on September 06, 2022, 10:33:23 AM
oh heavens, yes, I am a non native english "Writer".
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Rune Rasmussen on October 05, 2022, 10:49:41 AM
Well, how should people know, we can only read what's written.


Anyhow; If bug fixing and other improvements relies on volunteers, maybe it's time to make it easier to contribute suggestions in other ways than the forum and such old fashion ways, and also have a proper issue tracker to work from. And not to forget, more people testing the proposals, before they are "blindly" added by someone not having time to test, and thus causing new bugs. Something t.ex. GitHub would give access to, and I'm pretty sure that would make VM much better and much more reliable in the long run.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Milbo on October 05, 2022, 23:33:13 PM
Use the svn and provide a patch. Anyone who provided good code got invited. Regardless the form. of course a svn patch is best. I am just the code guard to prevent what you've written yourself.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Rune Rasmussen on October 06, 2022, 08:30:59 AM
Sure, but there is no issue tracker, and most people have no clue what's going on here most of the time. What you're working on, and which patches you have gotten already. And as this case shows us, quite a few issues is just forgotten and lost in the forum for quite some time.


Also, people mostly don't need a invite, they just want to propose a simple change from time to time to different projects, like GitHub makes possible in a much easier way for those being familiar with it - as most probably is today. At the same time as old fashioned patches still would be possible to handle.


Still, I've understood it as you prefer svn for some for you valid reason, and that's probably fine, even though it means less people contributing. Anyhow an issue tracker connected to the svn would also help in this case.


Beyond that I'm not really into criticising the choices and the project, I just think it would help the project and you to move on using more modern and common options in the development, taking of some workload from yourself, and getting more eyes and resources into development and testing. As it's now the interest for VM has declined, lots of stores have moved to other more stable and popular systems, myself I've only two VM stores left, probably only one by the end of the year. Not necessarily because VM itself is so bad, but with the lost interest and use there is less developers making payment modules and other integrations needed in different parts of the world for it, it's to costly to do just for a few. But sure, also the increased complexity of Joomla has made it a less valid choice for more plain webshops, so there is more into it for sure.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Milbo on October 11, 2022, 01:09:19 AM
https://dev.virtuemart.net/projects/virtuemart/repository
You can read here whats going on.

and concerning the tracker https://forum.virtuemart.net/index.php?topic=148837.msg531672#msg531672

and a svn patch is the very similar to github. Anyone can take the svn code, use it on his git and make svn patches.

We had this discussion a lot of times. There are studies showing, the bigger the project, the more likely they still use svn and NOT git. GIT is great for small projects.

Joomla is big and uses git? You tell nonsense Milbo. yeheh. The difference is the code style. Joomla breaks a lot things down to quite abstract code. Big work is seperated in a lot of files. The other stuff are libraries, which have usually small classes and small functions. It is of course an art for itself. This code style is also reasoned in GIT. I am not talking about the components like com_content. I just talk about the core. So if you take a look in the libraries of the core, you see for example the folder vendor. As far as I know, any folder there is originally an own GIT project.

VM is a framework on the joomla framework and plays with this frameworks. So from the GIT perspective, joomla consists of the libraries folder, the admin application, the frontend application and the components in that applications and the templates. Any of them could be an own GIT project and you can also handle all of them in one GIT project. Because any of the items listed above are seperated from the rest.

But in ecommerce it is very hard to manage. For example the cart logic. The cart "interferes" all the time. The cart itself is just the player on the framework, if the framework changes, the cart can fail. The cart handles products, shipment, payment, calculates the invoice, takes the user data, handles the shopping process. The VM core is just more monolithic than the joomla core, that is part of the nature of a CMS/Framework and ecommerce system.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: Rune Rasmussen on October 11, 2022, 09:26:32 AM
Quote from: Milbo on October 11, 2022, 01:09:19 AM
https://dev.virtuemart.net/projects/virtuemart/repository (https://dev.virtuemart.net/projects/virtuemart/repository)
You can read here whats going on.

Actually not, we can only see what's being pushed out when you feel it's at such stage that it can. We don't know what you or anyone else have on the table, which patches you have gotten but haven't looked into and pushed out yet, which issues has been forgotten or overseen in the forum etc.

Beyond that, there are project who have seen increased involvement after switching to GIT, no mater what coloured studies tells about BIGGER projects.

https://github.com/zencart/zencart/discussions/4805#discussioncomment-3303153
Quote from: zcwiltand since moving development to github, there has been increasing involvement of community members.
(in fact of late the majority of development has been due to the contribution of non core team members)
and I love that that is happening

But it's your project indeed, and you do as you like and feel with it for sure. Can't argue on that.

Edit! When it comes to bigger open source projects, we find eCommerce projects like WooCommerce, Prestashop etc. all being available at GitHub - with bigger user and contributor bases. Just to have it mentioned, for what it's worth.
Title: Re: Editor CustomField do not work anymore with JCE 2.9.12+
Post by: hazael on October 11, 2022, 14:33:12 PM
vmJsApi::addJScript('mceAddControl-' . $row, 'tinymce.execCommand("mceAddControl", true, "field-' . $row . '-customfield_value");', true, false, true);

This solution is not entirely good and should not go to the core.  This works with JCE and Tinymce, but... If you apply a different editor globally - for example CodeMirror or Simple - Editing the product using a custom field such as Editor will cause a loop and overload the server. I've reported this problem before, but I wasn't sure what the cause was - it's all clear now

https://forum.virtuemart.net/index.php?topic=148857.0