MODx inventory? modifications??

bwentebwente Member
in Help edited January 2008
Hi,

Has anyone modified the snippet to post back all the xml data back into a database from the store? Or maybe just the contact info for mailing updates and reminders?

Just checking here first, didn't have time to re-invent the wheel.
Comments
  • lukeluke FoxyCart Team
    What exactly are you looking for?

    We have an integration with Campaign Monitor, if that's what you're talking about... once you get the XML parsed, you should be able to do just about anything you want to.
  • The snippet for inventory is well done. I can poke at it and get it to do what I want. I was just making sure someone hadn't already done it for MODx. As always I am under a time restraint.
  • brettbrett FoxyCart Team
    Not sure if this is what you're talking about, but I know at least one (actually, I think two, but for sure one) person has done a simple XML -> MySQL dump. Would that help? I've asked them to comment on this thread if they have the time.

    That'd allow you to store all the data you'd need so you can process it later. Might be useful in some situations.
  • Hi Bwente,

    I am launching a site today that does just this, integrating MODx with Foxycart. I'll be making it consumable code for everyone in the near future, in the meantime just email me at [my username] at gmail and I can send you the basics.

    Bdogsputnik
    Number 1 Fan of Foxycart
  • <?
    # schema:
    #  CREATE TABLE CREATE TABLE `foxy_orders` (
    #   `id` int(11) NOT NULL auto_increment,
    #   `order_id` int(11) default NULL,
    #   `foxy_data` text NOT NULL,
    #   `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
    #   `processed_at` datetime default NULL,
    #   PRIMARY KEY  (`id`)
    # ) ENGINE=MyISAM AUTO_INCREMENT=227 DEFAULT CHARSET=utf8
    //
    // Finally, set your key to decrypt the XML that you receive from FoxyCart.
    // This must match *exactly* what you entered at http://www.foxycart.com/admin
    $key =  "abracadabra";
    
    if (isset($_POST["FoxyData"])) {
    	// ===================================================================================================
    	// DECRYPT YOUR DATA
    	// (do not modify)
    	// ===================================================================================================
    	// Decrypt the data using your $key
    	// First, include the rc4crypt.php file
    	include 'class.rc4crypt.php';
    	// Then decrypt the XML
    	$FoxyData_encrypted = urldecode($_POST["FoxyData"]);
    	$FoxyData_decrypted = rc4crypt::decrypt($key,$FoxyData_encrypted);
    
    	// ===================================================================================================
    
      if (!mysql_connect('DBHOST', 'DBUSER', 'DBPASS')) die("no connection to MySQL");
      if (!mysql_select_db('not4sale_production')) die("couldn't select database");
    
    
      mysql_query("INSERT INTO foxy_orders (created_at,foxy_data) VALUES (NOW(),'".mysql_escape_string($FoxyData_decrypted) ."')");
    
      echo "foxy";
    }
    else {
      echo "no post data!";
    }
    ?>
    
  • Well, no tabs, but you get the idea. This should do the trick.
Sign In or Register to comment.