Back to PhocacartProduct class

Method getProductIdByOrder

public static
getProductIdByOrder
(mixed $orderId)

Method getProductIdByOrder - Source code

public static function getProductIdByOrder($orderId)
{
    $db = Factory::getDBO();
    $query = ' SELECT a.id' . ' FROM #__phocacart_products AS a' . ' LEFT JOIN #__phocacart_order_products AS o ON o.product_id = a.id' . ' WHERE o.id = ' . (int) $orderId . ' ORDER BY a.id' . ' LIMIT 1';
    $db->setQuery($query);
    $product = $db->loadObject();
    return $product;
}