I’m trying out the query below to display the logged in member’s purchases made with Simple Commerce. I copied the code from this post
http://ellislab.com/forums/viewthread/190267/
When I try to preview, I get a syntax error. Could someone let me know what I have wrong? I’m using EE version 2.3.1.
I have the following at the top of the template
<?php
$member_id = $this->EE->session->userdata['member_id'];
?>And then the following in the body
{exp:query sql="SELECT * FROM exp_simple_commerce_purchases
JOIN exp_simple_commerce_items ON exp_simple_commerce_items.item_id = exp_simple_commerce_purchases.item_id
JOIN exp_channel_data ON exp_simple_commerce_items.entry_id = exp_channel_data.entry_id
WHERE exp_simple_commerce_purchases.member_id = '<?php echo $this->EE->session->userdata['member_id'];?>'"}
<h1>Your Courses</h1>
<a href="http://{field_id_11}"><h3>{field_id_9}</h3><p></a><br />
{field_id_10}<br />
<br />
{if no_results}<br />
<h1>Your Courses</h1><br />
You have not yet purchased any courses.<br />
{/if}<br />
{/exp:query}
Thanks
Susan