without sample of code it is hard to guess what possible solution might be.

Is information about sold product stored anywhere??