VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: gjrweb on October 25, 2012, 12:22:36 pm

Title: Payment Methods - Sort order/Order list during checkout
Post by: gjrweb on October 25, 2012, 12:22:36 pm
 Joomla 2.5.7 / Virtuemart 2.0.12f

We added 3 payment options to Virtuemart, the list order is not properly displayed in the front-end of the shop during checkout when selecting your preferred payment option.
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: gjrweb on October 26, 2012, 11:24:37 am
No known issues or a fix yet?
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Jason Farmer on October 27, 2012, 23:18:22 pm
same...

vm 2.0.12b
J 2.5.6

index.php?option=com_virtuemart&view=cart&task=editpayment

Payment method order does not get used .. they just seem to appear in a random order.


and on vm 2.0.12d
(http://s3.amazonaws.com/diigo/thumbnail_550/5563275_141274922_8407858.jpg?AWSAccessKeyId=0R7FMW7AXRVCYMAPTPR2&Expires=1351376830&Signature=g1jptr%2BHS8x2wG4xNI5B6DqgMGo%3D)
Screenshot of problem on demo.virtuemart.net (http://www.diigo.com/item/image/3bdsl/uk79)
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: gjrweb on November 02, 2012, 08:41:25 am
Glad to see thre are more people having the same problem.

You already managed to get a fix?
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Jason Farmer on November 02, 2012, 10:52:50 am
Nope, no fix.

I've had a look at the code and its using the Joomla JTable class to fetch and display these items ... there's no simple db query to add an order by clause to... I've had a look at the documentation for the class and  haven't found any way of implementing a sort order - I feel that there must be one, and I'm just not looking for the right term... 
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: gjrweb on November 09, 2012, 15:54:57 pm
This is the code to generate the list of payment options, in /components/com_virtuemart/views/cart/tmpl/select_payment.php

   echo "<fieldset>";
      foreach ($this->paymentplugins_payments as $paymentplugin_payments) {
          if (is_array($paymentplugin_payments)) {
         foreach ($paymentplugin_payments as $paymentplugin_payment) {
             echo $paymentplugin_payment.'<br />';
         }
          }
      }
    echo "</fieldset>";


Would be great to integrate the order list here, as it should work!

Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Jason Farmer on November 13, 2012, 13:12:00 pm
Unfortunately the order field is not present in the payment plugins array ... so it can't be done in the view - at least not without accessing the database...

Code: ($this->paymentplugins_payments) [Select]
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; <input type="radio" name="virtuemart_paymentmethod_id" id="payment_id_5" value="5">
<label for="payment_id_5"><span class="vmpayment"><span class="vmpayment_name">Direct Bank Transfer</span><span class="vmpayment_description"><div class="payment-details"><p>Pay using your online banking's 'Pay a Bill' option, then call the office so that we can confirm your enrolment.</p>
<p>You will usually be able to start your course immediately</p></div></span></span></label>

            [1] =&gt; <input type="radio" name="virtuemart_paymentmethod_id" id="payment_id_4" value="4">
<label for="payment_id_4"><span class="vmpayment"><span class="vmpayment_name">Phone</span><span class="vmpayment_description"><div class="payment-details"><p>Pay over the phone using your credit or debit card. You will usually be able to start your course immediately.</p></div></span></span></label>

            [2] =&gt; <input type="radio" name="virtuemart_paymentmethod_id" id="payment_id_2" value="2">
<label for="payment_id_2"><span class="vmpayment"><span class="vmpayment_name">Cheque</span><span class="vmpayment_description"><div class="payment-details">
<p><strong>We will need to wait until your cheque clears before you can start your course.</strong></p></div></span></span></label>

        )

    [1] =&gt; Array
        (
            [0] =&gt; <input type="radio" name="virtuemart_paymentmethod_id" id="payment_id_1" value="1">
<label for="payment_id_1"><span class="vmpayment"><span class="vmpayment_name">Paypal</span><span class="vmpayment_description"><div class="payment-details"><p>Immediate Start : Paypal is a secure payment service for all credit and debit cards, and you don't need a paypal account to use it.</p></div></span></span></label>

        )

)

Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: alistair|ctyou on November 15, 2012, 01:57:50 am
Unfortunately, the order of the payment methods is determined by the order in which the plgVmDisplayListFEPayment event fires.

Long story short:

Try ordering the payment plugins in Joomla:

Extensions | Plugins
change - Select Type - to vmpayments
click on Ordering column to sort by order
arrange order of plugins
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: gjrweb on November 23, 2012, 10:20:40 am
Hi alistair|ctyou,

Thanks! That work around just did it!

This is a bug for sure, is it already solved in virtuemart 2.0.14?
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: nickelas on April 28, 2013, 10:36:10 am
Quote from: alistair
Long story short:

Try ordering the payment plugins in Joomla:

Extensions | Plugins
change - Select Type - to vmpayments
click on Ordering column to sort by order
arrange order of plugins

Great workaround for getting the payment methods in the right order
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: eag on January 16, 2014, 03:22:54 am
Long story short:

Try ordering the payment plugins in Joomla:

Extensions | Plugins
change - Select Type - to vmpayments
click on Ordering column to sort by order
arrange order of plugins

Thank you alistair
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: lliseil on August 13, 2014, 20:11:13 pm
Just to confirm alistair's workaround works on VM 2.6.6
Thank you for sharing alistair|ctyou!
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Milbo on August 14, 2014, 09:11:41 am
This is a bug for sure, is it already solved in virtuemart 2.0.14?

It is not a bug, it is a consequence of the joomla plugin system, it is a general problem http://www.nonumber.nl/news/blog/242-plugin-order-is-important. Atm we plan a parallel system, which works without the joomla trigger system. More kind of firing events.
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: lliseil on August 26, 2014, 20:03:17 pm
Good to read Milbo's details. atm VM updates reversed previous payements' plugins orders, 'Paypal' returning on first amongst activated.
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: gba on January 25, 2018, 10:58:12 am
Hi!

I am using VirtueMart 3.2.12 and Joomla!3.8.3.
Unfortunately still it is not possible to sort the payment methods in cart frontend according to the sort order set in VM payment methods backend list.
The workaround above is good as long you have just one payment method for each type (i. e. standard, paypal, sofort).
I have two payment methods of type 'standard'. These two methods are not sortable, even with this workaround.
Anyone any useful hint for solving that?
Thank you very much in advance!

Kind regards,
Gerald
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Jörgen on January 25, 2018, 11:59:56 am
You can sort these standard types. Type one before type two, byt You can not split these, they move as a block and the whole block is dependent on the plugin order. But as I said within the block You can change the order. You can make a new "Standard" plugin and this could then be moved around. But that needs some coding.

regards

Jörgen @ Kreativ Fotografi
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Milbo on January 25, 2018, 20:28:14 pm
Imho there is no coding necessary. The payment methods have an ordering. But as you said, you can only create an order within the same plugin.
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: gba on January 25, 2018, 20:38:40 pm
Quote
... you can only create an order within the same plugin.
The sort order field of payment plugins is ignored in frontend.
How can I sort two payment plugins of the same type 'standard' for example?
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Jörgen on January 26, 2018, 00:41:59 am
I use this setting and It works for me since long time. Set the desired number to make the order You want. Th Payment option with the lowest number comes to the top.

regards

Jörgen @ Kreativ Fotografi
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: gba on January 26, 2018, 07:32:27 am
Hi!
Now I understand:
First I have to bring the payment plugins in the right order using the Joomla plugins backend list.
Then I can sort payment methods within the same payment plugin using the sort order field.
Thank you very much!
Title: Re: Payment Methods - Sort order/Order list during checkout
Post by: Jörgen on January 26, 2018, 07:57:56 am
Yes  ;)

That is the way to do it.

"All is for the best in the best of all possible Worlds"

regards

Jörgen @ Kreativ Fotografi