SEO Redirection Help Needed!

Hi Experts,

I have one E-commerce website Site is working well for me but when any product ends up it shows 404 error in Google Webmaster tool Or goes blank like this category have no product or sold all the products and is blank now.
But I want when product ends up from any category then it should redirect to the main category page like

Can Anybody suggest me how to do that please...

Many thanks in advance.

Poster :
Ajeet Singh