Back to PhocacartOrderView class

Method getItemDownloads

public
getItemDownloads
(mixed $orderId, mixed $orderProductId)

Method getItemDownloads - Source code

public function getItemDownloads($orderId, $orderProductId)
{
    $db = Factory::getDBO();
    // BE AWARE
    // productid is ID of Product Ordered not of product
    // productquantity is QUANTITY of Product Ordered not of product
    // select all files except attributes as these are selected in attributes
    $query = 'SELECT DISTINCT p.id AS productid,' . ' pd.id, pd.download_token, pd.download_file, pd.download_folder, pd.published, pd.type' . ' FROM #__phocacart_order_products AS p' . ' LEFT JOIN #__phocacart_order_downloads AS pd ON p.id = pd.order_product_id AND (pd.type = 0 OR pd.type = 1 or pd.type = 2)' . ' WHERE p.id = ' . (int) $orderProductId . ' AND p.order_id = ' . (int) $orderId . ' ORDER BY p.id';
    $db->setQuery($query);
    $items = $db->loadObjectList();
    return $items;
}