I'm trying to get a list of products ordered on the checkout_success page so I can add some Facebook share buttons for each one. I can do the rest if I can manage to get a list of the products into an array.
I have this in includes/languages/english/html_includes/mytemplate/define_checkout_success.php
I'm getting the below output. It's only returning one product, when the order has two products. Is this the way the db->Execute function works, limiting the results to 1? Is there another way I can get all results?PHP Code:$orders_query = "SELECT * FROM " . TABLE_ORDERS . "
WHERE customers_id = :customersID
ORDER BY date_purchased DESC LIMIT 1";
$orders_query = $db->bindVars($orders_query, ':customersID', $_SESSION['customer_id'], 'integer');
$orders = $db->Execute($orders_query);
$orders_id = $orders->fields['orders_id'];
$products_query = "SELECT products_id, products_name
FROM " . TABLE_ORDERS_PRODUCTS . "
WHERE orders_id = '$orders_id'
ORDER BY products_name";
$products = $db->Execute($products_query);
echo '<pre>';
var_dump($products);
echo '</pre>';
object(queryFactoryResult)#23 (5) { ["is_cached"]=> bool(false) ["resource"]=> resource(530) of type (mysql result) ["cursor"]=> int(0) ["EOF"]=> bool(false) ["fields"]=> array(2) { ["products_id"]=> string(4) "1994" ["products_name"]=> string(61) "Widget Product Name" } }


Reply With Quote

