pizzapi icon indicating copy to clipboard operation
pizzapi copied to clipboard

Adding Toppings to Pizza

Open PatOConnor43 opened this issue 7 years ago • 10 comments

Hi @aluttik,

Did you have any ideas on how this should be implemented? It seems like picking toppings on the website and validating the order should have enough information to map what the letters mean for each topping. Is this something that you're already working on? If not, I may give it a shot this week.

PatOConnor43 avatar Mar 19 '17 06:03 PatOConnor43

@PatOConnor43: actually, a Menu payload already contains descriptions for each topping under the top level "Toppings" object :) I just haven't put in the work yet, but implementing this should be pretty easy.

If you want to take a look, here's a pretty printed version of tests/fixtures/menu.json: https://gist.github.com/aluttik/515b8507210a0585c8a38bd43a3469c8

If you just want the names for each code, here's a snippet I found with jq:

{
  "Bread": {
    "Fe": {"Name": "Feta Cheese"},
    "J":  {"Name": "Jalapeno Peppers"},
    "K":  {"Name": "Bacon"},
    "Si": {"Name": "Spinach"}
  },
  "Pasta": {
    "B":  {"Name": "Beef"},
    "C":  {"Name": "Cheese"},
    "Cp": {"Name": "Shredded Provolone Cheese"},
    "Cs": {"Name": "Shredded Parmesan"},
    "Du": {"Name": "Premium Chicken"},
    "E":  {"Name": "Cheddar Cheese"},
    "Fe": {"Name": "Feta Cheese"},
    "G":  {"Name": "Green Peppers"},
    "H":  {"Name": "Ham"},
    "J":  {"Name": "Jalapeno Peppers"},
    "K":  {"Name": "Bacon"},
    "M":  {"Name": "Mushrooms"},
    "N":  {"Name": "Pineapple"},
    "O":  {"Name": "Onions"},
    "P":  {"Name": "Pepperoni"},
    "Pm": {"Name": "Philly Steak"},
    "R":  {"Name": "Black Olives"},
    "Rr": {"Name": "Roasted Red Peppers"},
    "S":  {"Name": "Italian Sausage"},
    "Si": {"Name": "Spinach"},
    "Td": {"Name": "Diced Tomatoes"},
    "Xf": {"Name": "Alfredo Sauce"},
    "Xm": {"Name": "Hearty Marinara Sauce"},
    "Z":  {"Name": "Banana Peppers"}
  },
  "Pizza": {
    "Ac": {"Name": "American Cheese"},
    "B":  {"Name": "Beef"},
    "Bq": {"Name": "BBQ Sauce"},
    "C":  {"Name": "Cheese"},
    "Cp": {"Name": "Shredded Provolone Cheese"},
    "Cs": {"Name": "Shredded Parmesan Asiago"},
    "Du": {"Name": "Premium Chicken"},
    "E":  {"Name": "Cheddar Cheese"},
    "Fe": {"Name": "Feta Cheese"},
    "G":  {"Name": "Green Peppers"},
    "H":  {"Name": "Ham"},
    "Ht": {"Name": "Hot Sauce"},
    "J":  {"Name": "Jalapeno Peppers"},
    "K":  {"Name": "Bacon"},
    "M":  {"Name": "Mushrooms"},
    "N":  {"Name": "Pineapple"},
    "O":  {"Name": "Onions"},
    "P":  {"Name": "Pepperoni"},
    "Pm": {"Name": "Philly Steak"},
    "R":  {"Name": "Black Olives"},
    "Rr": {"Name": "Roasted Red Peppers"},
    "S":  {"Name": "Italian Sausage"},
    "Sa": {"Name": "Salami"},
    "Sb": {"Name": "Sliced Italian Sausage"},
    "Si": {"Name": "Spinach"},
    "Td": {"Name": "Diced Tomatoes"},
    "X":  {"Name": "Robust Inspired Tomato Sauce"},
    "Xf": {"Name": "Alfredo Sauce"},
    "Xm": {"Name": "Hearty Marinara Sauce"},
    "Xw": {"Name": "Garlic Parmesan White Sauce"},
    "Z":  {"Name": "Banana Peppers"}
  },
  "Sandwich": {
    "Ac": {"Name": "American Cheese"},
    "Bd": {"Name": "Blue Cheese Sauce"},
    "C":  {"Name": "Cheese"},
    "Cs": {"Name": "Shredded Parmesan Asiago"},
    "Du": {"Name": "Premium Chicken"},
    "E":  {"Name": "Cheddar Cheese"},
    "Fe": {"Name": "Feta Cheese"},
    "G":  {"Name": "Green Peppers"},
    "H":  {"Name": "Ham"},
    "Ht": {"Name": "Hot Sauce"},
    "J":  {"Name": "Jalapeno Peppers"},
    "K":  {"Name": "Bacon"},
    "M":  {"Name": "Mushrooms"},
    "Mh": {"Name": "Mango Habanero Sauce"},
    "N":  {"Name": "Pineapple"},
    "O":  {"Name": "Onions"},
    "P":  {"Name": "Pepperoni"},
    "Pm": {"Name": "Philly Steak"},
    "Pv": {"Name": "Sliced Provolone"},
    "Rd": {"Name": "Ranch Dressing"},
    "Rr": {"Name": "Roasted Red Peppers"},
    "Sa": {"Name": "Salami"},
    "Sb": {"Name": "Sliced Italian Sausage"},
    "Si": {"Name": "Spinach"},
    "Td": {"Name": "Diced Tomatoes"},
    "X":  {"Name": "Pizza Sauce"},
    "Z":  {"Name": "Banana Peppers"}
  },
  "Wings": {
    "J":  {"Name": "Jalapeno Peppers"},
    "K":  {"Name": "Bacon"},
    "N":  {"Name": "Pineapple"},
    "Td": {"Name": "Diced Tomatoes"}
  }
}

aluttik avatar Mar 19 '17 07:03 aluttik

I got the API spitting toppings back to me by adding a 'Toppings' dict to the 'Tags' dict on a product, so like: order.add_item('12THIN') order.data['Products'][0]['Tags'][u'Toppings'] = u'Ac=1,B=1,Du=1,Fe=1'

So, we could modify the Order.add_item() method to allow it to accept toppings, or add a custom pizza to the Order.menu object, but neither of those seem super great.

@aluttik - would this be a good time to add a Pizza object, and allow the Order.add_item() method to process that object? I could probably knock that out tomorrow.

ggrammar avatar Feb 05 '18 00:02 ggrammar

@gamagori I guess, but honestly I'm giving up on this project. I made this years ago as a learning experience and haven't really looked at it since. I work on a lot of professional projects now and I don't even live near a Dominos anymore, so I really don't have the time or motivation to worry about this one.

So yeah, if I were you I'd just fork the repo and change it however you like. It's probably only a matter of time until I delete the repo entirely.

aluttik avatar Feb 05 '18 01:02 aluttik

@aluttik I'm in the learning experience portion of my career - do you mind if I take it over? I live across the street from a Dominos, I've got plenty of time and reason to steward it.

ggrammar avatar Feb 05 '18 02:02 ggrammar

@gamagori sure man, it's all yours :)

I'll send you a transfer request - you'll have to delete any existing fork of this project you have and accept the email within a day. Anyone who visits aluttik/pizzapi should then get redirected to gamagori/pizzapi.

All the credit I'd like is to be named in a Contributors list of some sort - you are more than welcome to change the "author" fields and stuff in the setup.py file.

aluttik avatar Feb 05 '18 02:02 aluttik

@gamagori actually I can't request the transfer until you delete your fork on GitHub. Once you do that, feel free to send me an email at [email protected] so I can transfer ownership to you.

aluttik avatar Feb 05 '18 02:02 aluttik

@aluttik The fork has been deleted - I've got all my changes backed up locally. I'll spin up a CONTRIBUTORS.md and give you an appropriate shout-out for all your work on this!

ggrammar avatar Feb 05 '18 02:02 ggrammar

I'm interested in making a Python script similar to roulette.pizza, except with vegetarian toppings - and I'd love to help build the toppings feature or Pizza object! Let me know if you're interested.

mojpg avatar Aug 23 '18 19:08 mojpg

@mozebdi Sure thing! Here are some ideas off the top of my head, but feel free to do a PR with whatever seems sensible:

  • Constructor with no args
  • Constructor with crust, sauce, and dict of toppings
  • Order.add_item() accepts a Pizza object as well as the existing code option

ggrammar avatar Aug 28 '18 00:08 ggrammar

Has there been any progress made on this subject? I have looked into it and can't seem to find any portion that would allow me change the defaults to be something that is customized.

After the order has been placed with .pay_with(), I am returned with a more detailed description of the toppings, but they are still default. I even tried modifying the defaults to be a custom pizza.

itrussell15 avatar Dec 10 '19 06:12 itrussell15