In preparation for their respective roles, Jake Gyllenhaal spent time with Jamie Reidy, the author of the book the film is based on, while Anne Hathaway spent time with Lucy Roucis, an actress stricken with Parkinson's disease, who has a role in the film.
In setting up the sex scenes, the actors were encouraged to improvise, but with their clothes on. Edward Zwick says that it is "colder" on a set because there are people all around, the camera, and other distractions. Therefore, the improvisation was useful in setting the scenes and shots for the actual shoot.
In designing the sex scenes, director Edward Zwick had the principals watch romantic comedies and sexually charged films - everything from Pillow Talk (1959) to 9 Songs (2004) to Ultimo tango a Parigi (1972) - and talk about what turned them on. Then some of those shots and ideas were incorporated into the making of the scenes.
The film is based on a book - Hard Sell: The Evolution of a Viagra Salesman - by former Pfizer rep Jamie Reidy. He says the book is a "jumping off point" and that there is no love interest in it as he removed all of those references, thinking that his mother would read the book.
Lawyers for both principals prepared documents about how much nudity the film would show. In the end, though, Edward Zwick simply pledged that there would be nothing in the film with which they were not comfortable.