Is there any easier way of grabbing the $result data in a custom datasource?

It seems very awkward to access the $result tree with an XMLElement object in my view.

I'm trying to retrieve values from a datasource by name within an entry and it seems very long winded to be looping over the object to get $entries and then looping again to get child nodes with values. All I need is 2 values from specific fields.

I know SymQL would be great, but surely there is an easier way to grab the email and entry ID from a datasource to pass onto my payment gateway using a custom datasource?

I'm appending new XML elements as well as casting variables from the Datasource into a payment gateway class.

It's been a while since doing this kind of manipulation so I may be missing a trick somewhere.

Any pointers would be great!

I used XPath in PHP, which I found a lot nicer than what you're describing.

Andrew, you're looking for parsing the datasource? Maybe you can get the two values you want and output them as output params? That seems pretty straight forward to me, otherwise you can always get the data right from the database with a couple of queries. Let me know if you're still stuck on this.

Thanks both, I used a little bit of SymQl as well as Customising a Datasource output.

I generated the Crypt (mcrypt) of all fields in required from the SymQl function and output the crypt as an extra node in the datasource. I could then create my front end form to pass it onto SagePay payment Gateway.. god they don't make it simple for us.

Nice write up David!

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