Isotope effect on the superconducting critical temperature of cuprates in the presence of charge order