Given a store layout, product categories grouped into shelves, and historical sales data, we investigate how the allocation of product categories can be optimized in a fashion that guides in-store traffic and stimulates impulse buying. The latter constitutes an important shopping behavior that amounts to over 50% of the revenue in some retail settings. Considering a small-scale grocery store in Beirut, we analyze 40,000 customer receipts in order to relate in-store customer traffic to product shelf allocations and the store layout. This prompts the development of a predictive regression model that estimates traffic densities along a shelf as a function of the shelf-space allocation and the location of the shelf in the store. This traffic model captures a "ripple effect"--that is, the change in traffic throughout the store resulting from any change in product allocation to shelves. The customer traffic model is embedded within a mixed-integer nonlinear program that sets the shelf allocations across the entire store, thereby prescribing better location and shelf-space decisions for all product categories in a way that maximizes impulse buying. To overcome the computational challenges posed by the model, we develop a linear approximation for the traffic construct in the objective function, while keeping bilinear terms in the formulation, in order to derive lower and upper bounds on the optimal objective value. Our methodology produces a layout that yields a 65% improvement in the expected impulse profit for the grocery store in Beirut. Managerial insights into the structure of the proposed store configuration are also discussed. Specifically, the allocation of a fast-mover to a shelf directly drives traffic, not only through adjacent shelves, but also, indirectly, through more distant shelves that lead to it. This, in turn, creates advantageous locations for highimpulse products, which may not be in the immediate vicinity of fast-movers. Finally, the study suggests that, from an impulse profit perspective, the location of a product category in the store is more important than adjusting the amount of shelf space that it is allocated. This challenges the classical research approach whereby extensive effort is invested to determine the relative space of products along a single shelf, taken in isolation, without considering its location in the store. [ABSTRACT FROM AUTHOR]