News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Payment Methods - Sort order/Order list during checkout

Started by gjrweb, October 25, 2012, 12:22:36 PM

Previous topic - Next topic

gjrweb

 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.
[GJ-R] Webdevelopment & E-Commerce Expert

gjrweb

[GJ-R] Webdevelopment & E-Commerce Expert

Jason Farmer

#2
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

Screenshot of problem on demo.virtuemart.net

[tr][td][/td][td]
Development[/td][td]Production[/td][/tr]
[tr][td]VirtueMart   [/td][td]
2.0.12b
[/td][td]
1.1.3
[/td][/tr]
[tr][td]Joomla!   [/td][td]
2.5.6
[/td][td]
1.5.14
[/td][/tr]
[tr][td]Mysql  [/td][td]
5.5.8
[/td][td]
5.0.51
[/td][/tr]
[tr][td]PhP   [/td][td]
5.3.5
[/td][td]
5.2.4
[/td][/tr]
[/table]

gjrweb

Glad to see thre are more people having the same problem.

You already managed to get a fix?
[GJ-R] Webdevelopment & E-Commerce Expert

Jason Farmer

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... 

[tr][td][/td][td]
Development[/td][td]Production[/td][/tr]
[tr][td]VirtueMart   [/td][td]
2.0.12b
[/td][td]
1.1.3
[/td][/tr]
[tr][td]Joomla!   [/td][td]
2.5.6
[/td][td]
1.5.14
[/td][/tr]
[tr][td]Mysql  [/td][td]
5.5.8
[/td][td]
5.0.51
[/td][/tr]
[tr][td]PhP   [/td][td]
5.3.5
[/td][td]
5.2.4
[/td][/tr]
[/table]

gjrweb

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!

[GJ-R] Webdevelopment & E-Commerce Expert

Jason Farmer

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>

        )

)



[tr][td][/td][td]
Development[/td][td]Production[/td][/tr]
[tr][td]VirtueMart   [/td][td]
2.0.12b
[/td][td]
1.1.3
[/td][/tr]
[tr][td]Joomla!   [/td][td]
2.5.6
[/td][td]
1.5.14
[/td][/tr]
[tr][td]Mysql  [/td][td]
5.5.8
[/td][td]
5.0.51
[/td][/tr]
[tr][td]PhP   [/td][td]
5.3.5
[/td][td]
5.2.4
[/td][/tr]
[/table]

alistair|ctyou

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

gjrweb

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?
[GJ-R] Webdevelopment & E-Commerce Expert

nickelas

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

eag

Quote from: alistair|ctyou on November 15, 2012, 01:57:50 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

lliseil

Just to confirm alistair's workaround works on VM 2.6.6
Thank you for sharing alistair|ctyou!
- A thread solved is a thread [SOLVED]! (a memo for myself)

Milbo

Quote from: gjrweb on November 23, 2012, 10:20:40 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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lliseil

Good to read Milbo's details. atm VM updates reversed previous payements' plugins orders, 'Paypal' returning on first amongst activated.
- A thread solved is a thread [SOLVED]! (a memo for myself)

gba

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