This would require some custom coding and modifications. I can give you an outline on how you would do this, but you will have to implement it yourself. You would need to add a new column in the database to store whether a product is in house or an affiliate. One way you can do this is to store the url in the database for the affiliate and don't store anything when its not an affiliate. Then you could either set this value directly in the database or create an interface to set it. Then on the product detail page, you'd have to put in a check on whether the product is affiliate or not and display the correct button accordingly.