<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://developer.directededge.com/index.php?action=history&amp;feed=atom&amp;title=ExampleStore_PHP</id>
		<title>ExampleStore PHP - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://developer.directededge.com/index.php?action=history&amp;feed=atom&amp;title=ExampleStore_PHP"/>
		<link rel="alternate" type="text/html" href="https://developer.directededge.com/index.php?title=ExampleStore_PHP&amp;action=history"/>
		<updated>2026-05-02T22:59:27Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>https://developer.directededge.com/index.php?title=ExampleStore_PHP&amp;diff=222&amp;oldid=prev</id>
		<title>Scott at 19:31, 23 November 2009</title>
		<link rel="alternate" type="text/html" href="https://developer.directededge.com/index.php?title=ExampleStore_PHP&amp;diff=222&amp;oldid=prev"/>
				<updated>2009-11-23T19:31:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;tr style=&#039;vertical-align: top;&#039; lang=&#039;en&#039;&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 19:31, 23 November 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;PHP&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;PHP&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;?php&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; * Ok, so the basics of how this thing works:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; * Ok, so the basics of how this thing works:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l214&quot; &gt;Line 214:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 214:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print_r($store-&amp;gt;getPersonalizedRecommendations(2));&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print_r($store-&amp;gt;getPersonalizedRecommendations(2));&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;?&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Scott</name></author>	</entry>

	<entry>
		<id>https://developer.directededge.com/index.php?title=ExampleStore_PHP&amp;diff=221&amp;oldid=prev</id>
		<title>Scott at 19:26, 23 November 2009</title>
		<link rel="alternate" type="text/html" href="https://developer.directededge.com/index.php?title=ExampleStore_PHP&amp;diff=221&amp;oldid=prev"/>
				<updated>2009-11-23T19:26:49Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;tr style=&#039;vertical-align: top;&#039; lang=&#039;en&#039;&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 19:26, 23 November 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l214&quot; &gt;Line 214:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 214:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print_r($store-&amp;gt;getPersonalizedRecommendations(2));&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print_r($store-&amp;gt;getPersonalizedRecommendations(2));&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;?&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Scott</name></author>	</entry>

	<entry>
		<id>https://developer.directededge.com/index.php?title=ExampleStore_PHP&amp;diff=212&amp;oldid=prev</id>
		<title>Scott: New page: &lt;source lang=&quot;PHP&quot;&gt; &lt;?php /*  * Ok, so the basics of how this thing works:  *  * It assumes that you have a local database for your store, and that store  * has a &quot;customer&quot; table and &quot;pro...</title>
		<link rel="alternate" type="text/html" href="https://developer.directededge.com/index.php?title=ExampleStore_PHP&amp;diff=212&amp;oldid=prev"/>
				<updated>2009-11-23T17:53:30Z</updated>
		
		<summary type="html">&lt;p&gt;New page: &amp;lt;source lang=&amp;quot;PHP&amp;quot;&amp;gt; &amp;lt;?php /*  * Ok, so the basics of how this thing works:  *  * It assumes that you have a local database for your store, and that store  * has a &amp;quot;customer&amp;quot; table and &amp;quot;pro...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;PHP&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/*&lt;br /&gt;
 * Ok, so the basics of how this thing works:&lt;br /&gt;
 *&lt;br /&gt;
 * It assumes that you have a local database for your store, and that store&lt;br /&gt;
 * has a &amp;quot;customer&amp;quot; table and &amp;quot;products&amp;quot; table.  In each of those tables&lt;br /&gt;
 * you have a unique ID that corresponds to each customer and product,&lt;br /&gt;
 * respectively.&lt;br /&gt;
 *&lt;br /&gt;
 * It also assumes there&amp;#039;s a third table, named &amp;quot;purchases&amp;quot; that has a list of&lt;br /&gt;
 * things purchased by customers.  Basically a mapping from the customer ID to&lt;br /&gt;
 * the product ID.  All of this is pretty standard store stuff.&lt;br /&gt;
 *&lt;br /&gt;
 * So, then what this class does is it handles:&lt;br /&gt;
 *&lt;br /&gt;
 * - Getting that data from those tables over to Directed Edge&lt;br /&gt;
 * - Doing incremental updates (adding customers, products, purchases)&lt;br /&gt;
 * - Finding products related to a given product&lt;br /&gt;
 * - Finding personalized product recommendations for a customer&lt;br /&gt;
 *&lt;br /&gt;
 * This is really just the starting point; there are some other exciting things&lt;br /&gt;
 * that can be done with the API once you&amp;#039;ve gotten your feet wet.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
define(&amp;#039;DB_HOST&amp;#039;, &amp;#039;localhost&amp;#039;);&lt;br /&gt;
define(&amp;#039;DB_USER&amp;#039;, &amp;#039;examplestore&amp;#039;);&lt;br /&gt;
define(&amp;#039;DB_PASS&amp;#039;, &amp;#039;password&amp;#039;);&lt;br /&gt;
define(&amp;#039;DB_NAME&amp;#039;, &amp;#039;examplestore&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
define(&amp;#039;DIRECTEDEDGE_USER&amp;#039;, &amp;#039;examplestore&amp;#039;);&lt;br /&gt;
define(&amp;#039;DIRECTEDEDGE_PASS&amp;#039;, &amp;#039;password&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
define(&amp;#039;EXPORT_FILE&amp;#039;, &amp;#039;examplestore.xml&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
class ExampleStore&lt;br /&gt;
{&lt;br /&gt;
    private $database;&lt;br /&gt;
&lt;br /&gt;
    public function __construct()&lt;br /&gt;
    {&lt;br /&gt;
&lt;br /&gt;
        mysql_connect(DB_HOST, DB_USER, DB_PASS);&lt;br /&gt;
&lt;br /&gt;
        if(!mysql_select_db(DB_NAME))&lt;br /&gt;
        {&lt;br /&gt;
            throw new Exception(&amp;quot;Could not connect to DB.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $this-&amp;gt;database = new DirectedEdgeDatabase(DIRECTEDEDGE_USER, DIRECTEDEDGE_PASS);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Export the list of products, purchases and customers to an XML file that&lt;br /&gt;
     * we can later push to the Directed Edge webservices.&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    public function exportFromMySQL()&lt;br /&gt;
    {&lt;br /&gt;
        $exporter = new DirectedEdgeExporter(EXPORT_FILE);&lt;br /&gt;
&lt;br /&gt;
        foreach($this-&amp;gt;getProducts() as $product)&lt;br /&gt;
        {&lt;br /&gt;
            $item = new DirectedEdgeItem($exporter-&amp;gt;getDatabase(), &amp;#039;product&amp;#039; . $product);&lt;br /&gt;
            $item-&amp;gt;addTag(&amp;#039;product&amp;#039;);&lt;br /&gt;
            $exporter-&amp;gt;export($item);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        foreach($this-&amp;gt;getCustomers() as $customer)&lt;br /&gt;
        {&lt;br /&gt;
            $item = new DirectedEdgeItem($exporter-&amp;gt;getDatabase(), &amp;#039;customer&amp;#039; . $customer);&lt;br /&gt;
&lt;br /&gt;
            foreach($this-&amp;gt;getPurchasesForCustomer($customer) as $product)&lt;br /&gt;
            {&lt;br /&gt;
                $item-&amp;gt;linkTo(&amp;#039;product&amp;#039; . $product);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            $exporter-&amp;gt;export($item);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $exporter-&amp;gt;finish();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Import the file that we created using exportFromMySQL to the Directed Edge&lt;br /&gt;
     * webservices.&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    public function importToDirectedEdge()&lt;br /&gt;
    {&lt;br /&gt;
        $this-&amp;gt;database-&amp;gt;import(EXPORT_FILE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Create a customer in the Directed Edge database that corresponds to the&lt;br /&gt;
     * customer in the local database with $id.&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    public function createCustomer($id)&lt;br /&gt;
    {&lt;br /&gt;
        $item = new DirectedEdgeItem($this-&amp;gt;database, &amp;#039;customer&amp;#039; . $id);&lt;br /&gt;
        $item-&amp;gt;addTag(&amp;#039;customer&amp;#039;);&lt;br /&gt;
        $item-&amp;gt;save();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Create a product in the Directed Edge database that corresponds to the&lt;br /&gt;
     * product in the local database with $id.&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    public function createProduct($id)&lt;br /&gt;
    {&lt;br /&gt;
        $item = new DirectedEdgeItem($this-&amp;gt;database, &amp;#039;product&amp;#039; . $id);&lt;br /&gt;
        $item-&amp;gt;addTag(&amp;#039;product&amp;#039;);&lt;br /&gt;
        $item-&amp;gt;save();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Create a purchase in the Directed Edge database from the product with&lt;br /&gt;
     * the local database IDs $customerId and $productId.&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    public function addPurchase($customerId, $productId)&lt;br /&gt;
    {&lt;br /&gt;
        $item = new DirectedEdgeItem($this-&amp;gt;database, &amp;#039;customer&amp;#039; . $customerId);&lt;br /&gt;
        $item-&amp;gt;linkTo(&amp;#039;product&amp;#039; . $productId);&lt;br /&gt;
        $item-&amp;gt;save();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns a list of related product IDs for the product ID that&amp;#039;s passed in.&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    public function getRelatedProducts($productId)&lt;br /&gt;
    {&lt;br /&gt;
        $item = new DirectedEdgeItem($this-&amp;gt;database, &amp;#039;product&amp;#039; . $productId);&lt;br /&gt;
        $related = array();&lt;br /&gt;
&lt;br /&gt;
        foreach($item-&amp;gt;getRelated(array(&amp;#039;product&amp;#039;)) as $item)&lt;br /&gt;
        {&lt;br /&gt;
            $related[] = str_replace(&amp;#039;product&amp;#039;, &amp;#039;&amp;#039;, $item);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return $related;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns a list of recommended products for the customer ID that&amp;#039;s passed in.&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    public function getPersonalizedRecommendations($customerId)&lt;br /&gt;
    {&lt;br /&gt;
        $item = new DirectedEdgeItem($this-&amp;gt;database, &amp;#039;customer&amp;#039; . $customerId);&lt;br /&gt;
        $recommended = array();&lt;br /&gt;
&lt;br /&gt;
        foreach($item-&amp;gt;getRecommended(array(&amp;#039;product&amp;#039;)) as $item)&lt;br /&gt;
        {&lt;br /&gt;
            $recommended[] = str_replace(&amp;#039;product&amp;#039;, &amp;#039;&amp;#039;, $item);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return $recommended;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private function getCustomers()&lt;br /&gt;
    {&lt;br /&gt;
        $result = mysql_query(&amp;quot;select id from customers&amp;quot;);&lt;br /&gt;
        $customers = array();&lt;br /&gt;
&lt;br /&gt;
        while($row = mysql_fetch_row($result))&lt;br /&gt;
        {&lt;br /&gt;
            $customers[] = $row[0];&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return $customers;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private function getProducts()&lt;br /&gt;
    {&lt;br /&gt;
        $result = mysql_query(&amp;quot;select id from products&amp;quot;);&lt;br /&gt;
        $products = array();&lt;br /&gt;
&lt;br /&gt;
        while($row = mysql_fetch_row($result))&lt;br /&gt;
        {&lt;br /&gt;
            $products[] = $row[0];&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return $products;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private function getPurchasesForCustomer($customer)&lt;br /&gt;
    {&lt;br /&gt;
        $result = mysql_query(sprintf(&amp;quot;select product from purchases where customer = &amp;#039;%s&amp;#039;&amp;quot;,&lt;br /&gt;
                                      mysql_real_escape_string($customer)));&lt;br /&gt;
        $purchases = array();&lt;br /&gt;
&lt;br /&gt;
        while($row = mysql_fetch_row($result))&lt;br /&gt;
        {&lt;br /&gt;
            $purchases[] = $row[0];&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return $purchases;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$store = new ExampleStore();&lt;br /&gt;
$store-&amp;gt;exportFromMySQL();&lt;br /&gt;
$store-&amp;gt;importToDirectedEdge();&lt;br /&gt;
&lt;br /&gt;
$store-&amp;gt;createCustomer(1000);&lt;br /&gt;
$store-&amp;gt;createProduct(1000);&lt;br /&gt;
$store-&amp;gt;addPurchase(1000, 1000);&lt;br /&gt;
&lt;br /&gt;
print_r($store-&amp;gt;getRelatedProducts(2));&lt;br /&gt;
print_r($store-&amp;gt;getPersonalizedRecommendations(2));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Scott</name></author>	</entry>

	</feed>