News:

Support the VirtueMart project and become a member

Main Menu

Issues edit Payment and Shipment Methods

Started by gowifi, August 30, 2022, 02:10:33 AM

Previous topic - Next topic

gowifi

I have setup a new Virtuemart site for a client and everything seemed to be running fine until I upgraded to the 4.2.0 version of Joomla.  Now I am unable to edit Payment Methods or Shipping Methods.

I have setup a brand new site running Joomla 4.1.5 and Virtuemart 4.0.4 and site runs fine.  I created a new standard Payment Method and no issues editing it.  I then upgraded Joomla to 4.2.0 and I am again unable to edit Payment or Shipping Methods.  In both cases the website sits for about 30 seconds before displaying an internal error with no details.  I can create new payment methods, but I can't edit existing.  It also doesn't matter the plugin type.  The same applies with Shipping Methods.

Though a process of elimination I found if I comment out line 70 in /administrator/components/com_virtuemart/views/paymentmethod/view.html.php "$payment->form->bind($payment->getProperties());" then the page loads without locking up, but obviously this is not a solution.

Has anybody else experienced this and do they have a solution?  Building the site again from scratch and staying at 4.1.5 will take a lot of time and sooner or later someone will update it again and break it.

Thanks

Milbo

Hello gowifi, I can assure you, there is no need to begin the page from scratch.

It must be something else. It could be your php version, for example. PHP8.1 is not supported, currently.

Or you installed a plugin which interferes. Enable the Error reporting and vmdebugger (you can do that in the vm config). Did you check your error log? There is a virtuemart and joomla one. you can open it in the VM Backend below "Tools".
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

gowifi

Sorry, I should have said, I'm running PHP 8.0.22

I don't have any plugins or extensions installed besides Virtuemart.  Just clean install of Joomla 4.2.0 and installed the Virtuemart 4.0.4 Package.  Created a Payment Method.  Tried to open it.  No other settings configured.  I also updated to 4.2.1 this morning, no change.

With maximum debugging turned on I do have a message showing which I've attached.  With all the vmdebug options set in Virtuemart the only file showing up under tools is the one for the joomla_update.php from when I moved to 4.2.1 this morning which shows nothing.

There are no vmdebugs in the output when you try and open a payment method. The vmdebug messages in other screens shows:
1 vmdebug Show All Errors, PHP-Version 8.0.22
2 vmdebug vmLanguage initialise en-GB
3 vmdebug vmTime: time to import plugins vmextended: 3.69548797607422E-5
4 vmdebug vmTime: time to import plugins vmuserfield: 5.69820404052734E-5
5 vmdebug vmTime: time to load config param $lang=1 and iniLang=0 $exeTrig = 1 now = 1: 0.0075840950012207
6 vmdebug Start used Ram 14M
7 vmdebug vmTime: "VirtueMartControllerLog" Finished task edit: 0.0139749050140381
8 vmdebug End used Ram 14M
9 vmdebug Peak memory peak 14M

Thanks

niosme

#3
1) I have the same problem with joomla 4.1.5 and joomla 4.2.1 with both php versions 7.4 and 8.
I opened the debug of the joomla and the error are this.
Happens in all installations. Cannot edit payments and shipment methods

*When shipping methods was working on previous versions of joomla when i was try to add it paypal as a payment method it wasnt be able to be setted and throwing an error. Please take a look at this also when it fixed.Try to add paypal as a new payment method.


2) Also with vm4 dont work fine with php8. Cannot edit a product in php 8 but in php 7.4 i can ( second scrennshot )
Fullstack Developer and Joomla Expert

niosme

This is a serious problem. Cannot edit any payment or shipment method. will it be fixed in future version?
Fullstack Developer and Joomla Expert

Milbo

This problem did not exist in j4 prior versions. I just checked. The problem is that the getProperties or bind function got changed, so it leads to loop. I found one attribute which creates the problem, but there is another and I dont get it debugged (memory errror with 2GB).
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

niosme

#6
same problem with custom fields.

You should remove the stable version from 4.0.6 as it dont work with the latest joomla versions ( >4.1.5 ) currently we have 4.2.2.
Also virtuemart dont work with php greater than 7.4

Newcomers and users try to install the virtuemart in a joomla site by downloading stable versions of joomla and virtuemart will get major issues and will never understand why that makes site unuseful.

So my complaint is that is not a stable version not even close to stable with all this issues.
Fullstack Developer and Joomla Expert

Joomill

#7
I have same issues.  :(
I upgraded from Joomla 3 to Joomla 4 and the latest version of Virtuemart.

Payment and Shipping don't work.
How to fix this?

gowifi

Not sure if this can help anybody else, but after a lot of trawling through code I have been able to identify where I think this issue has come from. 

In the latest versions of Joomla (4.2.0 onwards) the file libraries/src/Form/FormFactory.php has had a new line added on about line 41, $form->setDatabase($this->getDatabase()); within the createForm function. 

It appears this is probably meant to add the database object into the form object that is returned.  Unfortunately with the payment plugin, shipping plugin, custom plugin and potentially any others, when you try and edit a record in the back end the entire database object with all it's call stack, languages, etc is returned in the form which then causes timeouts as the object return is too big to handle.

For now I have been able to get my site working and make edits to the methods in the backend by commenting out this line but obviously this is only a temporary fix, and I'm assuming this line was added in for a reason and I don't yet know what I will have broken by commenting it out.  If somebody has a more better solution I'd love more info.

Thanks

Milbo

Quote from: niosme on September 07, 2022, 11:04:05 AM
same problem with custom fields.

You should remove the stable version from 4.0.6 as it dont work with the latest joomla versions ( >4.1.5 ) currently we have 4.2.2.

Ehrm, you should a bit learn the usual release behaviour of software, or the read the promises of software. If VM works on j4.0.x and j4.1.x it should also run on j4.2.x without changes.

Quote from: niosme on September 07, 2022, 11:04:05 AM
Also virtuemart dont work with php greater than 7.4
and VM works with php8.1. Maybe we overlooked some, but we really worked a lot on that.

Quote from: niosme on September 07, 2022, 11:04:05 AM
Newcomers and users try to install the virtuemart in a joomla site by downloading stable versions of joomla and virtuemart will get major issues and will never understand why that makes site unuseful.

So my complaint is that is not a stable version not even close to stable with all this issues.
Yeh and by common definition, the j4.2.2 is not stable. They have to work on that and must release a new version. And we say all the time, do not use it with j4, because j4 itself is buggy.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

Quote from: gowifi on September 12, 2022, 07:11:59 AM
Not sure if this can help anybody else, but after a lot of trawling through code I have been able to identify where I think this issue has come from. 

In the latest versions of Joomla (4.2.0 onwards) the file libraries/src/Form/FormFactory.php has had a new line added on about line 41, $form->setDatabase($this->getDatabase()); within the createForm function. 

It appears this is probably meant to add the database object into the form object that is returned.  Unfortunately with the payment plugin, shipping plugin, custom plugin and potentially any others, when you try and edit a record in the back end the entire database object with all it's call stack, languages, etc is returned in the form which then causes timeouts as the object return is too big to handle.

For now I have been able to get my site working and make edits to the methods in the backend by commenting out this line but obviously this is only a temporary fix, and I'm assuming this line was added in for a reason and I don't yet know what I will have broken by commenting it out.  If somebody has a more better solution I'd love more info.

Thanks


Yepp, that is a more detailled explanation of what I wrote here. But it is not only the db object, it is also the form itself, so the form tried to load itself again and that leads to a loop. We can unset it before.

We do now the same as we did already, many, many, many times. We fix a joomla bug with a workaround in our code. We can do that, but the blaming should go to joomla and not vm.
Quote from: Milbo on September 06, 2022, 23:31:38 PM
This problem did not exist in j4 prior versions. I just checked. The problem is that the getProperties or bind function got changed, so it leads to loop. I found one attribute which creates the problem, but there is another and I dont get it debugged (memory errror with 2GB).

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

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/

gowifi

Thank you.   :)  I can confirm version 4.0.7 allows access to payment and shipping methods again.

gowifi

Opps, look like I spoke too soon.  That update has fixed the issue in the back end, but in the front end the method is still not working and looks like a similar problem

I've traced it back to the line ~174 in the administrator/components/com_virtuemart/plugins/vmpsplugin.php file in the public function onSelectedCalculatePrice.

if (!$method = $this->getVmPluginMethod ($cart->{$idName}) or empty($method->{$idName})) {

It appears the $method object being returned has all the database stuff loaded into it again.

Milbo

The db is just "linked" like a pointer in C. But I cannot reproduce a problem there
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/