I'm working on a store that only has downloadable products in it. I need to get each customer's downloadable products and be able to sort them by product name and sku. My current code works in retrieving all the download links.
$purchasedItems = Mage::getResourceModel('downloadable/link_purchased_item_collection') ->addFieldToFilter('purchased_id', array('in' => $purchasedIds)) ->addFieldToFilter('status', array( 'nin' => array( Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING_PAYMENT, Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PAYMENT_REVIEW ) ) );
However, this does not return the product name nor the sku. So I am attempting a join on the collection to the
$productTableName = Mage::getSingleton('core/resource')->getTableName('catalog/product_flat'); $purchasedItems->getSelect() ->join(array('products' => $productTableName), 'main_table.product_id = products.entity_id', array('products.*'));
var_dump($purchasedItems) returns a
Mage_Downloadable_Model_Resource_Link_Purchased_Item_Collection Object. But I cannot iterate over the
Any help would be greatly appreciated.