A few years ago, as consumers were quickly replacing flip phones with smartphones, Domino’s Pizza CEO Patrick Doyle charged his company’s IT team with this request:

Make it so a customer could order a pizza while waiting for a stoplight.

Think about this for a second. There are 34 million potential combinations of pizza on the Domino’s menu. Maybe some customers order a large pepperoni. But there are others who might go through the menu and order a spinach and provolone pizza with barbecue sauce.

How could an app enable customers to wade through all those selections in the 17 seconds it takes, on average, for the light to turn green?

The answer to this question goes a long way toward explaining how Domino’s became the most technologically adept chain in the restaurant business — one that has revolutionized the way concepts think of technology and its potential to bring in business.

Customers can now order on an app, by voice, by sending a pizza emoji over social media, or through their television.

Domino’s has backed these efforts with an unprecedented marketing campaign aimed at the ease of ordering. Customers are now more likely to order from one of these digital platforms than they are to order via phone. And they’ve done so in droves: Company sales and franchisee profits have surged.

Domino’s is an old dog that taught itself a bunch of new tricks.

The seemingly tired, old, pizza delivery chain became a major e-commerce retailer in just a few short years, one that operates as much like Amazon as it does Papa John’s. The ease has helped Domino’s fit in nicely with a culture populated with smartphones where precious seconds matter — even if those seconds are spent at a stoplight.

It’s difficult to overstate how far Domino’s has come as a company.

Between 2006 and 2008, same-store sales at Domino's domestic locations fell a cumulative 10 percent. Over that period, revenues dropped from $1.5 billion to $1.4 billion. The company had $1.7 billion in debt. And the worst of the recession hadn’t even started.

The company was shedding franchisees, and the number of domestic locations in 2008 fell by more than 100, to just over 5,000 locations. The company’s stock fell below $3 a share in November 2008.

The company then introduced several new products and famously changed its pizza recipe the next year, and sales began to grow. Same-store sales have risen in each of the past seven years, including 12 percent last year. Franchisees are more profitable, and the stock is up — way up.

If you’d been lucky enough to purchase $1,000 in Domino's shares that November in 2008, you’d have nearly $52,000 right now.

By comparison, investors who bought $1,000 worth of Chipotle Mexican Grill stock in November 2008 and then sold it at peak last August before its recent $300 freefall, would have had nearly $20,000.

Ease of ordering has helped the company generate consistent sales growth. “The technology portion is a significant part of their sales driver,” said Peter Saleh, analyst with financial services firm BTIG.

“You can order on your watch, order on your phone, however you feel comfortable ordering it,” Saleh said.

“Those are playing a major role in their sales growth and market share gains.”

Kevin Vasconi, who has been Domino’s chief information officer since 2012, said that the company’s product quality remains the most important element of its improvement.

“It does seem like technology recently has been the driver,” he said. “But a lot of groundwork was laid before we doubled down on technology. We have a great product and a really good value, and if we didn’t have those things, the technology story wouldn’t be nearly as big.”

Domino's builds technology platforms like Lego bricks.

Kelly Garcia, Domino’s vice president for e-commerce development, likens the company’s technology efforts to a series of Lego bricks. Every platform and every system, he says, is built to adapt to future uses.

“When you’re thinking from a technology perspective, you can’t guess the experiences they want,” Garcia said.

The first such brick was laid many years ago, in 2002, five years before Steve Jobs introduced the iPhone and eight years before Doyle was promoted to CEO.

That was when Domino’s started converting company-owned units to its own point-of-sale system, called Pulse. The company then required franchisees to convert to this system by 2008.

How did Domino's secure franchisee buy-in?