Not sure if I have enough information to get an answer, but I'm looking for a book I read in the early 80's, probably published in the 70's. It was about a boy who wanders into what I believe may have been a candy shop, but turns out to be run by a wizard, who takes the boy on as an apprentice. I don't remember any of the plot. It seems like the book might have been illustrated, and there might have been something to do with a conical purple hat with polka dots. And the wizard might have eventually turned out to be evil. That's really about all I can remember. I'm sure this is a long shot that anyone will even recognize this, but any clues are appreciated.