public static
getAttributeOptionDownloadFilesByOrder
(mixed $orderId, mixed $productId, mixed $orderProductId)
public static function getAttributeOptionDownloadFilesByOrder($orderId, $productId, $orderProductId)
{
$db = Factory::getDBO();
$wheres = array();
$wheres[] = ' oa.order_id = ' . (int) $orderId;
$wheres[] = ' oa.product_id = ' . (int) $productId;
$wheres[] = ' oa.order_product_id = ' . (int) $orderProductId;
// only order_option_id not order_attribute_id - as stored is info about ordered option, not about ordered attribute
$q = ' SELECT av.download_folder, av.download_file, av.download_token, a.id AS attribute_id, av.id AS option_id, oa.id AS order_option_id, av.title AS option_title, a.title AS attribute_title' . ' FROM #__phocacart_attribute_values AS av' . ' LEFT JOIN #__phocacart_attributes AS a ON a.id = av.attribute_id' . ' LEFT JOIN #__phocacart_order_attributes AS oa ON oa.option_id = av.id' . ' WHERE ' . implode(' AND ', $wheres) . ' ORDER BY av.id';
$db->setQuery($q);
$files = $db->loadAssocList();
return $files;
}