I need a form that has to be linked with a Payment method. I am rather picky, though ... it should be de Icepay method (I searched the forums ... and I noticed nobody has used it in combination with ChronoForms. Sorry about that, but I need this particular one)
In the tutorial of the Icepay method I need this PHP code:
if ( $_SERVER['REQUEST_METHOD'] == "POST" )
{
require_once( "icepay.php" );
$cc = new ICEPAY_CC( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );
$url = $cc->Pay( "VISA", "EN", "USD", 199 );
header( "location: " . $url );
}
?>
So, what I did was I pasted it in the "On Submit Code - after sending emails". Don't know if that is the right place, but hey, the form responded🙂 and it now gives me the error:
Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in C:\wamp\www\agenda\components\com_chronocontact\libraries\customcode.php(51) : eval()'d code on line 5
Warning: require_once(http://localhost/agenda/components/com_chronocontact/icepay/icepay.php) [function.require-once]: failed to open stream: no suitable wrapper could be found in C:\wamp\www\agenda\components\com_chronocontact\libraries\customcode.php(51) : eval()'d code on line 5
Fatal error: require_once() [function.require]: Failed opening required 'http://localhost/agenda/components/com_chronocontact/icepay/icepay.php' (include_path='.;C:\php5\pear') in C:\wamp\www\agenda\components\com_chronocontact\libraries\customcode.php(51) : eval()'d code on line 5
I am guessing here that Joomla doesn't allow me (or the form) to simply acces an external piece of code. Am I right? Is there a solution to this? Can I "tell" ChronoForm that it is OK to use the file? Or am I barking up a wrong tree? Thanks in advance for an answer 😀
Check the message: URL file-access is disabled in the server configuration It's problem with the server setup, not with Joomla or ChronoForms.
That said, you could do this with the ReDirect plugin - there are many similar examples in the forums here with other services.
Bob
I have a ChronoContact form. I also have the 'receiving' .php file with the Payment script. When I
- turn on the Redirect plugin on the form
- tell the Redirect plugin to to the right .php file
- the Payment script cannot 'get' the $_POST data from the form. So for ex. $_POST['name']; comes up empty though I can see that it is in the array in the debug info:
$_POST: Array ( [naam] => chiel )
So ... for some reason when the data are posted and the Payment script is excecuted the $_POST string is empty:
echo $_POST['naam'];
returns nothing. What am I doing wrong? Thanks again for the answer!
$_POST Array: Array ( [customer_first_name] => asdfas [customer_email] => asdfdsaf plus other stuff...
BUT on my receiving PHP file -- posted_results.php
when I print_r the $_POST variable or echo $_POST['customer_first_name'] --- it is always empty..
Any thoughts?
I STILL HAD CHECKED the DB CONNECTION to YES in the special tab to connect to the database.
I built the deal out with the table connection and got it submitting to the database, THEN decided to do a custom .php for inserting into my database.
Come back adn disable to the DB connections tab and your .php file will then detect the _POST array properly
For others:
- turned off the Redirect Plugin
- simply added the .php script as the "Submit URL" on the form. Works great🙂
The ReDirect and cURL plugins will work with most payment gateways where there is an API that allows sumbission using POST or GET (broadly submission by form or by URL).
If you use the OnSubmit box, as Tengu has then you will lose all other ChronoForms functionality as ChronoForms never sees the form results and cannot run checks, save data or send emails.
If there is a PHP file to be included then you can probably use that directly, though it may need to be 'included' in some OnSubmit code; or you may be able to use the code in it and pull out parts to use in ChronoForms. It depends entirely on the way the API is structured (though most are wrappers for CURL or the similar Fsock functions).
There is no particular reason why having the DB Connection enabled or disabled will affect the availability of the $_POST data. It's much more to do with the way you write your code.
Bob
action page - was a .php page that literally said
PHP---
print_r($_POST);
print_r($_REQUEST);
echo($_POST['variable_name'];
close-php-tag
AND I was getting nothing returning...
THEN, kept the page the same - and turned OFF DB Connection and re-submitted and it worked.
That's why I said what I said --- but if you say so ---
I was thinking that maybe the "prepping" of the data to go to the Database may have done something strange to the $_POST data somehow....
I found something out: the setup is as follows:
- I have got a Chrono form where I collect data (they need to go in the DB)
- I have a 'index2.php' file that sets up the payment for my Gataway. At the end of the script it posts the data to a .aspx file somewhere on the Net
Now:
- When I set my form to do a redirect (either "in the form or via the redirect plugin"): the data of the form are stored in the DB, but the index2.php file can't get the POST-ed data: $_POST['naam']; comes up empty
- When I have my form and do a Submit URL it is the other way around: the data are NOT stored in the DB but the index.php file is able to grab the POST-ed data.
So ... is it impossible to do both? Or am I doing something wrong? (As I said, I am not that knowledgable ... but I get '10' points for trying every option ....)
I was thinking that maybe the "prepping" of the data to go to the Database may have done something strange to the $_POST data somehow....
Well, anything is possible but the $_POST array should still be available after the DB save.Bob
I entered a .php file into the Submit URL -- so the Database save was never happening.
so the thing that "broke" the _POST data was the combination of having a custom Submit URL action file PLUS having the DB Connection clicked YES --- does that make sense.
I can easily recreate it on my end...
Yes I did misundertand.
If you are using an OnSubmit URL then ChronoForms never sees the data, so the DB connection code isn't run. I find it hard to see how it can have any affect on the $_POST array :-(
But I'm happy to believe you, not something I've ever tested.
Bob
Please can I see the index2.php file you are redirecting to - post it here or email or pm it to me.
Bob
Check connect to db-base after creating the table.
Submit the stuff to the dbase once - which is what I did.
then add a OnSubmitURL with print_r($_POST)
and you should see what i saw.
The two helped me create this site which is an iframed joomla page with a minmal template... but before they were using a static page as their rebate center... with no search or filters...
http://www.frontendaudio.com/Rebate-Center-s/166.htm
Password protect the login page -- and they submit new rebates with an easy form with image uploads...
TONS OF custom PHP and Javascript inside the form fields in chronoconnectivity and chronoform -- and walla...
Here's what I would try with your Icepay form.
Add a hidden input to the Form HTML
<input type='hidden' name='IC_CheckSum' value='' />
Use the ReDirect Plug-in and put these entries.
In the Target URL box: https://pay.icepay.eu/Checkout.aspx
In the Extra Code before URL box:
<?php
// Functie die random nummer maakt voor OrderID
function randomkey($length){
$pattern = "1234567890";
for($i=0;$i<$length;$i++){
$key .= $pattern{rand(0,9)};
}
return $key;
}
$IC_OrderID = 'Z'.randomkey(8);
JRequest::setVar('IC_OrderID', $IC_OrderID);
$_SESSION['transactionID'] = $IC_OrderID;
$IC_CheckSum = SHA1( '{encryptioncode}|{MerchantID}|{amount}|EUR|'.$IC_OrderID.'|IDEAL|FORTIS' );
JRequest::setVar('IC_CheckSum', $IC_CheckSum);
?>
In the 'Field Names from your form' boxes:
IC_OrderID : IC_OrderID
IC_ResponseType : IC_ResponseType
IC_Description : IC_Description
$IC_CheckSum : $IC_CheckSum
In the Extra fields Data box
bl={???}
IC_Merchant={MerchantID}
IC_Amount=300
IC_Currency=EUR
IC_Language=NL
IC_Country=NL
IC_Reference={klaantnummer}
IC_PaymentMethod=IDEAL
IC_Issuer=FORTIS
IC_URLCompleted={mydomain}components/com_chronocontact/icepay/ok_page.php
IC_URLError={mydomain}components/com_chronocontact/icepay/error_page.php
IC_PINCode={???}
All the {xxx} entries need to be replaced by the specific values for the IcePay setup.If some of the entries in the Extra Fields data box are actually variable then they can be moved to the 'Field Names from your form' box using a hidden input to create the box.
Bob
thanks for that. I will have a look and try it out. In the meantime I am making a form so I can actually get the desired info from the client. And I have to say ... the more I 'dive in' ChronoForms, the more I am starting to like it, and starting to see all you can do with it.
I'll let you know if I have tried your code. Thanks a million for helping out 🤔