Search

Okay so I have a simple form where the user types in there name, email, comments, and uploads a photo. When they click submit on this form they get redirected to paypal and the Paypal IPN sends the paypal transaction id back.

I am basically trying to join the recorded form data with the paypal data on the invoice id(entry #). My goal is to be able to output the information the user submited on form and include the paypal transaction id(which the ip return and is in the database).

I am currently looking into the Symql in an attempt to create a custom data source. however I am not sure if this is the best way to accomplish this.

If I am not mistaken the paypal extension that is already around allows you to store the data and link it to the customer, I did this before. Not sure where the thread is but if you find the extension thread you find details, always if you are using the extension for paypal transations

@gunglien

you are correct the extension does allow you to store the data however I want to be able to use it as a data source, and join it with what the user field out on the submission form(that they field out before they payed with paypal). The problem is the extension stores the data in a mysql table.

To clarify this a little more all I basically want to do is return a list of form submissions where the user actualy paid and completed the paypal transaction.

if you need the data from a mysql table, always if your knowledge of SQL is not that bad you can create a 'custom' datasource. That is create a normal datasource, open the data-sources folder and modify the one that you created. Change the grab() function and make it return the XML (Symphony XML element or String) you want by running the queries as you deem necessary.

But I am sure I did this without creating custom datasources... I will try have quick look tomorrow as its been a while since I last used it.

I ended up just outputting additional xml because I couldn't figure out how to easily edit the original xml output.

I added the following code to the grab function:

$xml = simplexml_load_string($result - > generate());
foreach($xml - > xpath('//entry') as $entry) {
    $id = $entry - > attributes() - > id;
    $reg_result = Symphony: : Database() - > fetch("SELECT `invoice`, `txn_id`, `payer_email` FROM sym_paypalpayments_logs WHERE invoice=$id");
    foreach($reg_result as $reg_row) {

        $reg_attributes = array('id' = > $reg_row['invoice']);

        $reg = new XMLElement('paidentry', false, $reg_attributes);
        $reg_txn_id = new XMLElement('txn_id', $reg_row['txn_id']);
        $reg_invoice = new XMLElement('invoice', $reg_row['invoice']);
        $reg_email = new XMLElement('payer_email', $reg_row['payer_email']);

        $reg - > appendChildArray(array($reg_txn_id, $reg_invoice, $reg_email));
        $result - > appendChild($reg);
    }
}

If anyone has any additional ideas I would be interested in seeing them

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details