Optional Paypal option

DrAg0nBoY 13 Nov, 2014
Hello,

I have a question. I would like to add into my chronoform an option for someone to pay with paypal. Now I have a problem, because I have no idea how to do that.

The thing is, that I would like to make a check box where someone chooses if he wants to pay with paypal or not. If he chooses yes, he is then, when he submits the form, to paypal to pay the amount. If not, he stays on the page.

I have no idea how to code stuff, that's why I chose Chronoforms because I did not have to do that, but it seems I will have to do it know.

Another problem I have is that, if I use userredirect I don't have a parameter for amount for paypal, because I have put my form up in such a way (you can se the form in the picture below).

I do hope you can help me with that. Thank you very much.

With kind regards,
Mitja
GreyHead 13 Nov, 2014
Hi Mitja,

The image didn't make it :-(

You can use the Event Switcher action with a few lines of code to switch between sending the user to PayPal or doing nothing.

Bob
DrAg0nBoY 13 Nov, 2014
Yeah as soon as I posted I saw that I did not have the image attached.

Here is the image: http://shrani.si/f/Q/vN/1ampPqfq/clipboard01.png .

And as I said, I have no idea how to make such things.
Max_admin 14 Nov, 2014
Hi,

Please check this FAQ:
http://www.chronoengine.com/faqs/70-cfv5/5212-event-switcher.html

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
DrAg0nBoY 14 Nov, 2014
Hello Max.

Thank you for the link, but as I already said I have no idea how to code stuff.

I would be really glad if someone could atleast write me a draft on how the code and everything should look at the end (looking at what my form looks like). That would be really great.

Thank you very much.
GreyHead 14 Nov, 2014
Hi Mitja,

I don't' see a 'PayPal ' checkbox on your form? What is it's name?

What is the logic that decides what the amount to pay should be? What are the names of the inputs used for that?

Bob
DrAg0nBoY 14 Nov, 2014
Hi,

for now I do not have a PayPal checkbox because I had no idea how to implement it.

The problem is getting the amount into the redirect user because I don't have a checkbox or something like that to get the amount. Because for now I have only what you can see in the screenshot and I then only get what the user checked on my email.

So first I need to get the amount from the checked item. When I have that I need a checkbox for PayPal. And after that the form needs to check if the user checked PayPal and if yes redirect him to PayPal with the amount that needs to be payed. If not just send the form to my mail.

And the problem is. I have no idea how to do all that. When I get home I can write you the names of the parameters. But for now, if you can make me a draft for all that I wrote you. That would be great.

Thank you very much for your help, and sorry for bothering you all so much.

With kind regards,
Mitja
GreyHead 14 Nov, 2014
HI Mitja,

Then you need to add a checkbox or radio button to let the user choose how to pay.

And you need to post here the logic of how the total amount is calculated and the inputs used for that.

Bob
DrAg0nBoY 14 Nov, 2014
Hi,

ok I will add a checkbox for PayPal or a checkbox to choose how to pay, if that's per PayPal or when you get the stuff home.

How the amount is calculated. The thing is, the user can choose whether to buy only one issue of the magazine (Nakup posameznih revij) or to buy the in a pack for a year (Naročilo na revijo). And every of those options has the description (like Naročilo na spletno stran) with the amount written beside the description.

Now what I need to do is, when someone chooses Naročilo na revijo, the form automatically chooses the amount, which is 29,95 and sends it to PayPal then.

The thing is, that I don't know how to code such a thing. I saw that someone has a hidden checkbox or something like that, which then automatically checks the correct amount, but I have no idea how to do something like that.

I do hope you know what I mean. And sorry for my English.

With kind regards,
Mitja
Max_admin 15 Nov, 2014
How many products do you have ? you can set the amount field name in the PayPal redirect settings to "amount", then add this code inside a "custom code" action before the "PayPal redirect" (which is going to be inside the even switcher):

<?php
$form->data["amount"] = 29.95;


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
DrAg0nBoY 16 Nov, 2014
Hey Max,

the problem is that the amount changes for every product. And I have 6 products, where 2 products are in one checkbox and 4 in another.

So I made a PayPal option. It's called Način plačila (the parametere name is nacin). I have three options one of which is PayPal (parametere name is PP).

Now like I said I have to different checkboxes for my items, one is called narocilo and the other izvod. And I have no idea how to get the amount for every item to send it to PayPal :/.

So that is that. If you can help me somehow, that would be great,

With kind regards,
Mitja
DrAg0nBoY 19 Nov, 2014
So can anyone help me with my problem? :/
GreyHead 19 Nov, 2014
Hi Mitja,

Still waiting for you to write **exactly** what the logic you want to use is. Unless you can specify that clearly there's no point in trying to write any code.

You may need to get help from someone with more programming experience.

Bob

PS In general, we don't write code for you here unless it is a simple example and is likely to be useful to other users.
Max_admin 21 Nov, 2014
This code snippet may help you to start, you need to change/repeat different parts, all dependent on your form fields names:

$total = 0;
//for every product you need to havea price below
$prices = array(
$form->data["checkbox_name"] => 100,
);
//if some checkbox is checked then add its price to the total
if(isset($form->data["checkbox_name"])){
$total = $total + $prices[$form->data["checkbox_name"]];
}
//set the paypal amount field to the total
$form->data["amount"] = $total;


Then your PayPal amount field has to be set to "amount" in the PayPal settings.

The code should be inside a "custom code" action ABOVE the "PayPal redirect".

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.