For years, we've used a mixture of white vinegar and water (vinegar kills the enzymes...that's what pets can smell that make them go back to the same spot again) and then just a regular carpet cleaner. Many products claim to remove the odor but they really only mask it (to the human nose, that is) and the pet can still smell the urine or feces in that spot. You must kill the enzymes and then remove the stain!
Way back when we took our dogs to classes, the instructor would have us bring a small spray bottle to class in case our dog had to go potty during class (in a large grassy yard). After scooping the poop or blotting, we would spray the spot and that would keep all the other dogs in the class (especially the males) from wanting to come over and "mark" on top of it.