Make a list in advance and stick to it - this will hopefully prevent you from compulsively buying things you don't need
Get into the habit of making a single trip once a week to take care of all your grocery shopping needs instead of several smaller trips throughout the week, this reduces the use of your car and reduces your time in the store and the chances that you'll buy items you don't really need.
Packaging will also be much larger than the actual product for many food items. Manufacturers know that shoppers assume that larger sized packaging equals a better deal. Before grabbing the largest box of a product, take the time to calculate the per unit or per weight cost. More often than you would expect, smaller packages of an item are actually a better deal than buying the same item in a larger package.
Checkout Layout: The checkout aisle of a store is like a mini mart in itself. This is because grocery stores know that they have a captive audience while you wait in line to pay for your groceries - The best way to avoid these temptations is to plan your shopping during off peak hours, plan late night and early morning trips when the aisle and checkout lanes are practically bare are the perfect time to get in and out of the grocery store as quickly as possible.