You could try a 'toilet', my hamster uses a sand bath as her toilet (although just for urinating), or you could use cardboard on the inside of the cage around where the hamster poops keep falling out. Otherwise a more permanent option could be a strong piece of plastic zip tied onto the outside to create a higher edge? Although before you do this I would suggest ensuring your cage is the correct size and depth as this may be the reason that the hamster is making a mess as they love to dig, which without a deep tray this can be the cause of a big mess. Hope this helps