PayPal form with Options

cyberspyder 17 Apr, 2019
I am trying to set up a form (I started with the PayPal demo form) and I need 2 options, a 4x8 brick that is $100 and an 8x8 brick that is $250. I have created a field where they select the option, then I also added 2 fields where they type in the text they want (2 lines). I was able to get the brick they choose to show as the item when it goes to Paypal, but how can I have it show their text and the price? I have included screen shots of what I have set up. I think my PHP is not right plus I am not sure how to make it show in the amount field in the Paypal redirect.

PayPal form with Options  image 1

PayPal form with Options  image 2

PayPal form with Options  image 3

PayPal form with Options  image 4
healyhatman 17 Apr, 2019
1 Likes
You SHOULD store all your products in a database, and the dropdown should have the ID of the product. But that may not be necessary if you only have two products.

SO what you need to do is fix all your PHP.
if($this->data("BRICK") == "4X8 Brick") 
return 100;
else
return 250;
Then you need to use the NAME you gave that php block, in your case "php11", for the amount. It's not form data it's action data so you use {var:php11} for the amount.
Max_admin 18 Apr, 2019
Answer
1 Likes
if you want to pass one item only to PayPal then do your processing in the PHP action and return an array of the item data:
if($this->data("BRICK") == "4X8 Brick"){
return ["name" => "4x8", "number" => "48x", "amount" => 100.00];
}else{
return ["name" => "8x8", "number" => "88x", "amount" => 250.00];
}
Then use {var:php_name.name} in Item name, {var:php_name.number} in item number and same for amount

Best reagrds
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
healyhatman 18 Apr, 2019
Yes, or do that. That's better.
cyberspyder 18 Apr, 2019
Thank you so much! That is awesome! Works like a charm!!
This topic is locked and no more replies can be posted.