In my workshops, I tell attendees that there are two good times to ask for testimonials:
1. When a customer compliments you. After thanking them, ask if you can write it up for their signature. Most people will consent. Customers don't usually do a very good job of writing testimonials, so you have to help them. They also tend to forget, so this method helps remind them. You can say something like: "I know you are busy, so let me write something up and send it to you for your signature."
Need some compliments in a hurry? Get on the phone and call some of your best customers to see how things are going. Ask if they were happy with their last order. Then listen.
2. At the end of a job. This is when your customers should be happiest and the great results or service you provided is still fresh in their minds. Again, probe by asking enough specific questions to develop a compelling endorsement.