If you are referring to a custom field to select products, one already exists:
If you are building a general attribute field for a plugin, taking a look at the B
BaseElementFieldType.php within the craft/app filder (that the product field above extends) will give you clues on how to recreate the UI to select products (or any other element).
The key file being
craft/app/templates/_includes/forms/elementSelect.html which will show you how to instantiate the
Craft.BaseElementSelectInput js class.
Hope that points you in the right direction. I am not sure if there is a full guide out there on how to use
Craft.BaseElementSelectInput js, but hopefully the above will get you most of the way there by looking at the code.