Author Topic: VM3.6.1 10121 Revision 10115 preventing some plugins from been selected.  (Read 240 times)

ssc3

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 134
    • Online Store Plugins
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

Code: [Select]
       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

  • Global Moderator
  • Jr. Member
  • *
  • Posts: 417
  • VirtueMart Version: VM 4.2 on Joomla 4.5
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

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

ssc3

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 134
    • Online Store Plugins
Re: VM3.6.1 10121 Revision 10115 preventing some plugins from been selected.
« Reply #2 on: September 16, 2019, 10:48:42 am »
Code: [Select]
    /**
     * 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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9918
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: VM3.6.1 10121 Revision 10115 preventing some plugins from been selected.
« Reply #3 on: September 16, 2019, 15:00:35 pm »
http://dev.virtuemart.net/attachments/1183/com_virtuemart.3.6.1.10150_package_or_extract.zip

Plugins should just call
Code: [Select]
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ssc3

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 134
    • Online Store Plugins
Re: VM3.6.1 10121 Revision 10115 preventing some plugins from been selected.
« Reply #4 on: September 16, 2019, 16:03:58 pm »
Tried that and it works well. The old plgVmOnCheckAutomaticSelectedPayment never did seem to make sense.

I think there are 3 native payment plugins using the old method, which you can obviously just update.

The problem is I have third party extensions that will crash on the update to VM 3.6.1

Some epecially the older ones are not on Joomla update and it will going be easy to get fixes to.

The first indication the merchant will have that there is a problem is when the orders stop comming in.
Virtuemart Payment Plugins

https://plugins.online-store.co.uk