I don't understand the last two sentences.
If that's your whole description of how a solar cell works, then that is not enough
the reason why electrons move from the n to p type is not entirely due to the photoelectric effect, but rather due to the process of "diffusion" where excess...