News:

Looking for documentation? Take a look on our wiki

Main Menu

plgVmOnSelectPayment function

Started by ruudjonk, October 25, 2011, 22:35:55 PM

Previous topic - Next topic

ruudjonk

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

alatak

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

ruudjonk

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

alatak

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.


ruudjonk

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.

ruudjonk

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.

unkelo

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

alatak

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

unkelo

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.


alatak

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";
                }

john sitjar

how to disable paypal if credit card is selected and vice versa thanks plz reply

GJC Web Design

???  they are radio buttons - thats what they do...
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation