VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: ruudjonk on October 25, 2011, 22:35:55 PM

Title: plgVmOnSelectPayment function
Post by: ruudjonk on October 25, 2011, 22:35:55 PM
Hello All,

Currently I'm working on a new VM 2 plugin but I got one question that I hope some of you guys can answer, didn't found the answer on the forum or wiki yet.

At the moment I'm using the plgVmOnSelectPayment() function inside the new plugin. If I'm correct this could let you create your own radio input field or extra input fields needed for the payment method.

Now, can this also be used to create multiple input radio fields? Let's say a payment provider offers more then one payment method, can this function be used to create a list of all those payment methods offered by only that one Payment service provider using only this one payment plugin?

Hope someone knows the anser to this one.

Thanks,
Ruud
Title: Re: plgVmOnSelectPayment function
Post by: alatak on October 26, 2011, 14:01:43 PM
Hi,

The function that u should call is plgVmDisplayListFEPayment()
Actually that function should return an array for each payment methods.

Please have a look at paypal plugin from the J version.
Title: Re: plgVmOnSelectPayment function
Post by: ruudjonk on October 26, 2011, 17:08:08 PM
Hello Alatak,

I'm using he paypal plugin as a reference but I can't see that function beeing used within the paypal plugin from the J version. ?
Title: Re: plgVmOnSelectPayment function
Post by: alatak on October 26, 2011, 17:21:02 PM
Hi,

Paypal is an extended class from vmPaymentPlugin.
You can find vmPaymentPlugin class in  components/com_virtuemart/helpers/vmpaymentplugin.php.

And Paypal uses the default function from vmPaymentPlugin.

Title: Re: plgVmOnSelectPayment function
Post by: ruudjonk on October 27, 2011, 19:34:24 PM
Hello Alatak,

Thanks, for the hint... I will take a look at it this weekend and let you know if I got it to work or not.
Title: Re: plgVmOnSelectPayment function
Post by: ruudjonk on May 29, 2012, 21:23:36 PM
Hello Alatak,

I didn't got the time to finish the plugin but the project is now active again and I think something is different now with 2.0.6.

Using the function we talked about can I still do the following:

When I change a payment method there need's to be an onchange event that will show addional html when selecting this new payment method.

Do you (or someone else) know what is the best way of doing this?

Thanks for you help again.
Title: Re: plgVmOnSelectPayment function
Post by: unkelo on June 08, 2013, 18:39:43 PM
Hi ,

I want exactly the same how hhe last post.

How can i use the plgVmOnSelectPayment function to show an html form if the  payment is selected ?
Have anyone a sample code  or plugin who uses such event trigger ?

Greetings uNkeLo
Title: Re: plgVmOnSelectPayment function
Post by: alatak on June 08, 2013, 19:43:02 PM
Hello
QuoteAt the moment I'm using the plgVmOnSelectPayment() function inside the new plugin. If I'm correct this could let you create your own radio input field or extra input fields needed for the payment method.
QuoteHow can i use the plgVmOnSelectPayment function to show an html form if the  payment is selected ?
To display the payment method, you should use
function plgVmDisplayListFEPayment (VirtueMartCart $cart, $selected = 0, &$htmlIn)

$htmlIn[]  is an array with all the forms for the payment.


Once the payment has been selected, use this function to check the data given by the client
public function plgVmOnSelectCheckPayment (VirtueMartCart $cart, &$msg)

You can look at the authorizenet payment plugin as an example
Title: Re: plgVmOnSelectPayment function
Post by: unkelo on June 08, 2013, 22:53:30 PM
Hi ,

Thanks for yoru anwser.

But i dont still reeally know how to make if its check statement and include my own html. if its selected.

public function plgVmDisplayListFEPayment (VirtueMartCart $cart, $selected = 0, &$htmlIn) {
   
return $this->displayListFE ($cart, $selected, $htmlIn);
               
if ($selected == 1) {
                echo "selected";
                }
else
                {
                echo"notselected";
                }
        }


That snipped doesnt works.
I also dont know where it is $htmlIn defined.
If i remove $htmlIN in thereturn row then i  have no radiobutton anymore with the payment method.

Eventually you can help with more hints i checked also the auhtorizenet but could not extract the sample code.

Title: Re: plgVmOnSelectPayment function
Post by: alatak on June 11, 2013, 11:20:54 AM
Hello
I wil do in a while a tutorial. I know i said that a long time ago .. but i must o it.

Look in your code
you do a return
return $this->displayListFE ($cart, $selected, $htmlIn);

so this code is never reached:

if ($selected == 1) {
                echo "selected";
                }
else
                {
                echo"notselected";
                }
Title: Re: plgVmOnSelectPayment function
Post by: john sitjar on October 02, 2014, 04:42:06 AM
how to disable paypal if credit card is selected and vice versa thanks plz reply
Title: Re: plgVmOnSelectPayment function
Post by: GJC Web Design on October 02, 2014, 11:20:03 AM
???  they are radio buttons - thats what they do...