Question: how does joffrey get poisoned?
Answer: During the feast, the Tyrell matriarch sneakily took the poisoned stone from Sansa's necklace and put it in Joffrey's wine glass while he was mocking his uncle, cutting open his wedding cake with a sword, and just acting the pompous fool in general. The Kingchild drank the toxic alcohol and died - painfully.