Transaction XML Datafeed Issues

I have Foxycart integrated in an instance of MODx.
I have enabled the Transaction XML Datafeed option enabled on my store and I have set the URL to the target page that processes the XML data.
I have also placed my custom code in both the "per transaction" area and the "per order" areas as instructed.
I have tested my code outside of the transaction datafeed code provided on the Foxycart site and it works correctly, but when I place it inside the provided PHP code it does not work.

Questions:
Are there any known bugs between Foxycart and MODx?
Could the "return true;" ending on my code be interfering with the processing of the data? (F.Y.I the return statement is required by MODx)
Comments
  • fc_adamfc_adam FoxyCart Team
    @rielmedia,

    No known bugs that I'm aware of between FoxyCart and MODx.

    Could you let us know what store this is for so we could take a look there? Also, could you clarify what you mean by "my code" in the following, and how you tested it exactly?
    I have tested my code outside of the transaction datafeed code provided on the Foxycart site and it works correctly, but when I place it inside the provided PHP code it does not work.
  • Sure! I created some php code that will take the information in the datafeed and store it in the modx database. I placed it in the area where it says "If you have custom code to run for each order, put it here:" on the example xml parsing code provided in the documentation here https://wiki.foxycart.com/v/2.0/transaction_xml_datafeed.

    The datafeed seems to work correctly still because I am not getting any errors on my Foxycart error log when I submit a transaction. Just not sure why my custom code is not working.
  • Ok so I have figured out that the following code "die("foxy");" is what is interfering with my MODX custom code. In MODx snippets of php code have to have a return value of true. Return, not die(). The Foxycart transaction xml datafeed needs the die() code and throws an error when I use return instead. This is a pretty big issue for my store. We are set to launch on March 1st! Is there anything I can do to get this working in time?
  • fc_adamfc_adam FoxyCart Team
    @rielmedia,

    Thanks for providing those details.

    The datafeed does indeed need to receive "foxy" as the only content in the response from the datafeed endpoint. That's what that die("foxy"); is doing.

    Perhaps try updating your snippet to return foxy like this: return "foxy";. From what I can see with how the snippets work, that should work.
  • I tried that and it did not work. Using return instead of die() causes the xml datafeed to return an empty value which breaks the script.

    Ultimately I was able to get this working by taking my processing script out of MODx and running it as a standalone PHP script without the help of MODx functions and variables. It is working now.
  • fc_adamfc_adam FoxyCart Team
    @rielmedia,

    I'm glad you were able to find a solution - sorry it relied on losing the connection to MODx
Sign In or Register to comment.