I am trying to develop a function to retrieve products with the same SKU code as the current product and list them in a table. I know I can use fn_get_product_data to get data by product ID but I don't seem to be able to find a way to get the same sku product's ids, so any suggestions or guidance would be highly appreciated.
Update:
Used db_get_field to execute a query for that.
If I understand you correctly, you can use the following function to get all products by specific sku
$params = array(
'extend' => array('description'),
'pcode' => $product['product_code'],
'exclude_pid' => $product['product_id'],
);
list($products, ) = fn_get_products($params);
fn_gather_additional_products_data($products, array(
'get_icon' => true,
'get_detailed' => true,
'get_additional' => false,
'get_options'=> true
));
(!) Not tested