Skip to content

parseFoxycartDatafeed

Everett Griffiths edited this page Aug 21, 2014 · 2 revisions

parseFoxycartDatafeed

Parses the FoxyCart XML Data Feed into local database records. Place this Snippet on one page and paste its URL into your Foxycart admin panel. Logs to foxycart.log

Parses the FoxyCart XML Data Feed into local database records. The data objects are structured hierarchically, but the save() event is delayed until the very end. (See all tables using the "foxy_" prefix). This snippet logs to the foxycart.log

You can tie any snippet you want to hook into any of 3 events:

  • per-product (via &product_hooks)
  • per-transaction (via &transaction_hooks)
  • per-postback (via &postback_hooks)

The Snippet will receive $scriptParameters corresponding to the relevant node of XML and the Snippet must return a message that evaluates to true on success, boolean false on fail.

USAGE

[[!parseFoxycartDatafeed? 
    &product_hooks=`updateInventory` 
    &transaction_hooks=`userCreate`]]

PARAMS

  • &product_hooks (string) comma-separated Snippet(s) to execute for each product that comes through the datafeed.
  • &transaction_hooks (string) comma-separated Snippet(s) to execute for each transaction that comes through the datafeed.
  • &postback_hooks (string) comma-separated Snippet(s) to execute for each post-back.
  • &api_key (string) This is primarily useful for testing or if you have multiple stores running on different contexts on your site. Defaults to the system setting: moxycart.api_key
  • &log_level (int) use this to provide more verbose logging for this snippet. Defaults to the system log_level setting (remember: it logs)