In the third table buy I want to obtain all the products of that selected category.
how can i do it with cortexproject?
I would like to see the steps to follow to reach that result.
If the product module defines the category ID and the buy module also defines the category ID, you can define a prefilter on a record list within the buy module record page (assuming you want to show them in a table).
From the top of my head, something like idCategory = ${record.values.idCategory} should do the trick (prefilter not tested but LGTM).