VM3.6.1 10121 Revision 10115 preventing some plugins from been selected.

Started by ssc3, September 11, 2019, 16:40:04 PM

Previous topic - Next topic

ssc3

Revision 10115 (virtuemart): - customfields for shoppergroups

Changes to cart.php seem to be preventing some payment plugins with extra fields on the cart page from been selected.

This occurs when one payment method is published.

If you have two or more methods published the cart will work as normal

Tested with native Authorize.Net as the only payment method.


See code changes in core at

http://dev.virtuemart.net/projects/virtuemart/repository/revisions/10115/diff/trunk/virtuemart/components/com_virtuemart/helpers/cart.php



I think the cause is


       function plgVmOnCheckAutomaticSelectedPayment(VirtueMartCart $cart, array $cart_prices = array(), &$paymentCounter) {

$return = $this->onCheckAutomaticSelected($cart, $cart_prices);
if (isset($return)) {
return 0;
} else {
return NULL;
}
}


This allows the credit card fields to be visible when the payment is selected.

There are a lot of third party plugins using that code as Authorize.Net is one of the older VM plugins.

Finding a fix would help keep them working.
Virtuemart Payment Plugins
https://plugins.online-store.co.uk

StefanSTS

--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

ssc3


    /**
     * plgVmOnCheckAutomaticSelectedPayment
     * Checks how many plugins are available. If only one, the user will not have the choice. Enter edit_xxx page
     * The plugin must check first if it is the correct type
     * @author Valerie Isaksen
     * @param VirtueMartCart cart: the cart object
     * @return null if no plugin was found, 0 if more then one plugin was found,  virtuemart_xxx_id if only one plugin is found
     *
     */


I think the problem is plgVmOnCheckAutomaticSelectedPayment is no longer allowed to return 0.

The original specification allowed this.

Any plugin that does this can no longer be selected.
Virtuemart Payment Plugins
https://plugins.online-store.co.uk

Milbo

http://dev.virtuemart.net/attachments/1183/com_virtuemart.3.6.1.10150_package_or_extract.zip

Plugins should just call

function plgVmOnCheckAutomaticSelectedPayment(VirtueMartCart $cart, array $cart_prices = array(), &$paymentCounter) {
return $this->onCheckAutomaticSelected($cart, $cart_prices, $paymentCounter);
}


which calls the rest and that works pretty generic. The pluginpart is then in "checkConditions", which be use its own code, call the parent and use its own code again.

The old checkAutomatic thing was quite shitty. It works now clean. Before, for example, we had to set the checkbox in the cart by js to enable an automatic set shipment/payment, when more than one available. Now you get a checkbox always for the first option.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Robert_ITMan

Sorry - I don't understand how to get this to work now - currently testing PHP 7.3 / J 3.9.18 / VM 3.6.11 10302

Looks like this is still an issue - did something change here? Notice Configuration settings are ignored for: "Enable Automatic Selected Payment". No matter what I select it is never selected in the cart by default.

Notice the cart no longer auto selects a Payment: No payment selected - even when there is only 1 to select.

P.S. UPDATED - I removed notes about shipping. Sorry I thought I also had an issue with "Enable Automatic Selected Shipment" not selecting or seeing my shipping method - but after noticed the shipping plugin was somehow unpublished (?!) ... publishing it fixed that (again - sorry)

WEBSITES @ OURFINGERTIPS
manage > develop > market > repeat

Save a lot of time and money when focused on building a website that works with marketing efforts to get more leads and sales from visitors.

www.ourfingertips.com

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/