The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Sessions and DataFeed

RickWRickW Member
in Help edited September 2009
This is somewhat complicated so here goes.
I have an area where a user logs in and then can make a purchase.
I'm using the xml data feed to store his purchase details in database.
I have the feed working fine, as is the data base.
However the username, which is stored as a $_SESSIONS variable disappears, and I can't include it with my posting to the database. Very strange.

This variable hasn't been destroyed, I checked that.
I've spent the morning reviewing $_SESSIONS and everything appeared correct.
Is there another way to accomplish the same thing?

Does the XML Datafeed somehow disable Sessions?
  • brettbrett FoxyCart Team
    Hi RickW.

    I might be totally missing you, but are you asking about the $_SESSIONS in your datafeed processing script? If that's the case, then the user's session won't be available because the user isn't the one making that request to your datafeed processing script.

    When the datafeed is sent, it's sent from the FC servers to your endpoint. The user isn't really involved, so there's no way their session info would be passed from FC to you. You could store the session data in a session variable in the FoxyCart transaction (with the h: prefix, more info here: ).

    Then you'd get it in the XML. But let's say your server is A and the user is B. FoxyCart is C. So B's sessions are only available in a B->A connection. The datafeed is C->A, so B isn't in that equation anywhere.

    Does that help or am I totally missing you?
  • If I understand you correctly, I should store the variable in a hidden field then process it as XML. Is there a test.xmldatafeed.php that shows how to process a custom field?
  • tookingstookings Member
    edited September 2009
    If it helps, it will show up in the XML like this (in <transaction>) if you did ...&h:code=med&h:sitename=internal_site&h:aff=123&...
    . <custom_field>
    .. <custom_field_name>code</custom_field_name>
    .. <custom_field_value>med</custom_field_value>
    . </custom_field>
    . <custom_field>
    .. <custom_field_name>sitename</custom_field_name>
    .. <custom_field_value>internal_site</custom_field_value>
    . </custom_field>
    . <custom_field>
    .. <custom_field_name>aff</custom_field_name>
    .. <custom_field_value>123</custom_field_value>
    . </custom_field>

    ...parsing through them is much like parsing discounts or taxes. (The periods are just my lame attempt to show a little indenting. :)
  • brettbrett FoxyCart Team
    (Nice job on the indenting. We need a new forum.)
Sign In or Register to comment.