'CLEAR', 'message' => $dryRun ? 'Would clear existing data' : 'Cleared existing data']; // STEP 2: Modifier Templates $tplLettuce = insertItem($bizId, 'Lettuce', '', 0, 0, 1, 0, 0, 1, 1, 1, $dryRun); insertItem($bizId, 'Regular', '', $tplLettuce, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Extra', '', $tplLettuce, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Light', '', $tplLettuce, 0, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'None', '', $tplLettuce, 0, 1, 0, 0, 0, 0, 4, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Lettuce', 'id' => $tplLettuce]; $tplTomato = insertItem($bizId, 'Tomato', '', 0, 0, 1, 0, 0, 1, 1, 1, $dryRun); insertItem($bizId, 'Regular', '', $tplTomato, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Extra', '', $tplTomato, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Light', '', $tplTomato, 0, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'None', '', $tplTomato, 0, 1, 0, 0, 0, 0, 4, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Tomato', 'id' => $tplTomato]; $tplSauce = insertItem($bizId, "Big Dean's Sauce", '', 0, 0, 1, 0, 0, 1, 1, 1, $dryRun); insertItem($bizId, 'Regular', '', $tplSauce, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Extra', '', $tplSauce, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Light', '', $tplSauce, 0, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'None', '', $tplSauce, 0, 1, 0, 0, 0, 0, 4, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => "Big Dean's Sauce", 'id' => $tplSauce]; $tplOnions = insertItem($bizId, 'Onions', '', 0, 0, 1, 0, 0, 1, 1, 1, $dryRun); insertItem($bizId, 'None', '', $tplOnions, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Grilled', '', $tplOnions, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Raw', '', $tplOnions, 0, 1, 0, 0, 0, 0, 3, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Onions', 'id' => $tplOnions]; $tplPickle = insertItem($bizId, 'Pickle Spear', '', 0, 0, 1, 0, 0, 1, 1, 1, $dryRun); insertItem($bizId, 'None', '', $tplPickle, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Add Pickle', '', $tplPickle, 0, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Pickle Spear', 'id' => $tplPickle]; $tplWingStyle = insertItem($bizId, 'Wing Style', '', 0, 0, 1, 0, 1, 1, 1, 1, $dryRun); insertItem($bizId, 'Bone-In', '', $tplWingStyle, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Boneless', '', $tplWingStyle, 0, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Wing Style', 'id' => $tplWingStyle]; $tplSize = insertItem($bizId, 'Size', '', 0, 0, 1, 0, 1, 1, 1, 1, $dryRun); insertItem($bizId, 'Regular', '', $tplSize, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Small', '', $tplSize, 0, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Size', 'id' => $tplSize]; $tplPortion = insertItem($bizId, 'Portion', '', 0, 0, 1, 0, 1, 1, 1, 1, $dryRun); insertItem($bizId, 'Full Order', '', $tplPortion, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Half Order', '', $tplPortion, 0, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Portion', 'id' => $tplPortion]; $tplSideExtras = insertItem($bizId, 'Add Extras', '$.50 each', 0, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Sour Cream', '', $tplSideExtras, 0.50, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Jalapenos', '', $tplSideExtras, 0.50, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'BBQ Sauce', '', $tplSideExtras, 0.50, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'Ranch', '', $tplSideExtras, 0.50, 1, 0, 0, 0, 0, 4, $dryRun); insertItem($bizId, 'Blue Cheese', '', $tplSideExtras, 0.50, 1, 0, 0, 0, 0, 5, $dryRun); insertItem($bizId, 'Mayo', '', $tplSideExtras, 0.50, 1, 0, 0, 0, 0, 6, $dryRun); insertItem($bizId, 'Aioli', '', $tplSideExtras, 0.50, 1, 0, 0, 0, 0, 7, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Add Extras', 'id' => $tplSideExtras]; $tplGuac = insertItem($bizId, 'Guacamole', '', 0, 0, 1, 0, 0, 1, 1, 1, $dryRun); insertItem($bizId, 'Without Guacamole', '', $tplGuac, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'With Guacamole', '', $tplGuac, 0, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Guacamole', 'id' => $tplGuac]; $tplAddIns = insertItem($bizId, 'Add-ins', '', 0, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Chicken', '', $tplAddIns, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Steak', '', $tplAddIns, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Shrimp', '', $tplAddIns, 0, 1, 0, 0, 0, 0, 3, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Add-ins', 'id' => $tplAddIns]; $tplChiliExtras = insertItem($bizId, 'Extras', '', 0, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Add Cheese', '', $tplChiliExtras, 0.50, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Add Onions', '', $tplChiliExtras, 0.50, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Extras (Chili)', 'id' => $tplChiliExtras]; $tplDressing = insertItem($bizId, 'Dressing', '', 0, 0, 1, 0, 1, 1, 1, 1, $dryRun); insertItem($bizId, 'Italian', '', $tplDressing, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Ranch', '', $tplDressing, 0, 1, 1, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Balsamic', '', $tplDressing, 0, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'Caesar', '', $tplDressing, 0, 1, 0, 0, 0, 0, 4, $dryRun); insertItem($bizId, 'Blue Cheese', '', $tplDressing, 0, 1, 0, 0, 0, 0, 5, $dryRun); insertItem($bizId, 'Thousand Island', '', $tplDressing, 0, 1, 0, 0, 0, 0, 6, $dryRun); insertItem($bizId, 'French', '', $tplDressing, 0, 1, 0, 0, 0, 0, 7, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Dressing', 'id' => $tplDressing]; $tplSaladProtein = insertItem($bizId, 'Add Protein', '', 0, 0, 1, 0, 0, 1, 1, 1, $dryRun); insertItem($bizId, 'No Protein', '', $tplSaladProtein, 0, 1, 1, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Chicken Breast or Burger Patty', '', $tplSaladProtein, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Grilled Shrimp', '', $tplSaladProtein, 0, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'Grilled Mahi Mahi', '', $tplSaladProtein, 0, 1, 0, 0, 0, 0, 4, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Add Protein (Salad)', 'id' => $tplSaladProtein]; $tplHotDogExtras = insertItem($bizId, 'Extras', '', 0, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Add Sauerkraut', '', $tplHotDogExtras, 0.50, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Add Cheese', '', $tplHotDogExtras, 0.50, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'TEMPLATE', 'name' => 'Extras (Hot Dog)', 'id' => $tplHotDogExtras]; // CATEGORIES AND ITEMS // World Famous Burgers $catBurgers = insertItem($bizId, 'World Famous Burgers', '', 0, 0, 1, 0, 0, 0, 0, 1, $dryRun); $actions[] = ['step' => 'CATEGORY', 'name' => 'World Famous Burgers', 'id' => $catBurgers]; $burger1 = insertItem($bizId, "Big Dean's Cheeseburger", 'Double meat double cheese - The burger that made Santa Monica famous!', $catBurgers, 0, 1, 0, 0, 0, 0, 1, $dryRun); $burger2 = insertItem($bizId, 'Single Beef Burger with Cheese', '', $catBurgers, 0, 1, 0, 0, 0, 0, 2, $dryRun); $burger3 = insertItem($bizId, 'Single Beef Burger', '', $catBurgers, 0, 1, 0, 0, 0, 0, 3, $dryRun); $burger4 = insertItem($bizId, 'Beyond Burger', 'Vegan burger patty w/ lettuce, tomato, and pickle spear', $catBurgers, 0, 1, 0, 0, 0, 0, 4, $dryRun); $burger5 = insertItem($bizId, 'Garden Burger', 'Vegetable patty prepared in the style of our burgers', $catBurgers, 0, 1, 0, 0, 0, 0, 5, $dryRun); $burger6 = insertItem($bizId, 'Chili Size Burger', 'Beef burger served open faced topped with all beef chili, cheese, and onions', $catBurgers, 0, 1, 0, 0, 0, 0, 6, $dryRun); foreach ([$burger1, $burger2, $burger3, $burger4, $burger5, $burger6] as $bid) { linkTemplate($bid, $tplLettuce, 1, $dryRun); linkTemplate($bid, $tplTomato, 2, $dryRun); linkTemplate($bid, $tplSauce, 3, $dryRun); linkTemplate($bid, $tplOnions, 4, $dryRun); linkTemplate($bid, $tplPickle, 5, $dryRun); } $actions[] = ['step' => 'ITEMS', 'category' => 'Burgers', 'count' => 6]; // Snacks and Sides $catSides = insertItem($bizId, 'Snacks and Sides', '', 0, 0, 1, 0, 0, 0, 0, 2, $dryRun); $actions[] = ['step' => 'CATEGORY', 'name' => 'Snacks and Sides', 'id' => $catSides]; $side1 = insertItem($bizId, 'Buffalo Wings', '', $catSides, 0, 1, 0, 0, 0, 0, 1, $dryRun); linkTemplate($side1, $tplWingStyle, 1, $dryRun); linkTemplate($side1, $tplSideExtras, 2, $dryRun); $side2 = insertItem($bizId, 'Frings', '1/2 French fries and 1/2 onion rings', $catSides, 0, 1, 0, 0, 0, 0, 2, $dryRun); linkTemplate($side2, $tplSideExtras, 1, $dryRun); $side3 = insertItem($bizId, 'French Fries', '', $catSides, 0, 1, 0, 0, 0, 0, 3, $dryRun); linkTemplate($side3, $tplSize, 1, $dryRun); linkTemplate($side3, $tplSideExtras, 2, $dryRun); $side4 = insertItem($bizId, 'Onion Rings', '', $catSides, 0, 1, 0, 0, 0, 0, 4, $dryRun); linkTemplate($side4, $tplSize, 1, $dryRun); linkTemplate($side4, $tplSideExtras, 2, $dryRun); $side5 = insertItem($bizId, 'Chili Fries', '', $catSides, 0, 1, 0, 0, 0, 0, 5, $dryRun); linkTemplate($side5, $tplChiliExtras, 1, $dryRun); linkTemplate($side5, $tplSideExtras, 2, $dryRun); $side6 = insertItem($bizId, 'Chicken Fingers and Fries', '', $catSides, 0, 1, 0, 0, 0, 0, 6, $dryRun); linkTemplate($side6, $tplPortion, 1, $dryRun); linkTemplate($side6, $tplSideExtras, 2, $dryRun); $side7 = insertItem($bizId, 'Chips and Salsa', '', $catSides, 0, 1, 0, 0, 0, 0, 7, $dryRun); linkTemplate($side7, $tplGuac, 1, $dryRun); $side8 = insertItem($bizId, 'Cheese Quesadilla', '', $catSides, 0, 1, 0, 0, 0, 0, 8, $dryRun); linkTemplate($side8, $tplAddIns, 1, $dryRun); $side9 = insertItem($bizId, 'Cheese Nachos', '', $catSides, 0, 1, 0, 0, 0, 0, 9, $dryRun); linkTemplate($side9, $tplAddIns, 1, $dryRun); insertItem($bizId, 'Chili Cheese Nachos', '', $catSides, 0, 1, 0, 0, 0, 0, 10, $dryRun); $side11 = insertItem($bizId, 'Mozzarella Sticks', '', $catSides, 0, 1, 0, 0, 0, 0, 11, $dryRun); linkTemplate($side11, $tplSideExtras, 1, $dryRun); $actions[] = ['step' => 'ITEMS', 'category' => 'Snacks and Sides', 'count' => 11]; // Sandwiches $catSandwiches = insertItem($bizId, 'Sandwiches', '', 0, 0, 1, 0, 0, 0, 0, 3, $dryRun); $actions[] = ['step' => 'CATEGORY', 'name' => 'Sandwiches', 'id' => $catSandwiches]; insertItem($bizId, 'Cajun Mahi Mahi', 'Lettuce, tomato, aioli, and guacamole', $catSandwiches, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Philly Cheese Steak', 'Grilled peppers and onions', $catSandwiches, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Cajun Chicken', 'Lettuce, tomato, and spicy aioli', $catSandwiches, 0, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'Turkey', 'Lettuce, tomato, and mayo', $catSandwiches, 0, 1, 0, 0, 0, 0, 4, $dryRun); insertItem($bizId, 'Turkey Club', 'Bacon, lettuce, tomato, and mayo', $catSandwiches, 0, 1, 0, 0, 0, 0, 5, $dryRun); insertItem($bizId, 'Grilled Cheese', 'Sourdough and American cheese', $catSandwiches, 0, 1, 0, 0, 0, 0, 6, $dryRun); insertItem($bizId, 'Grilled Ham and Cheese', '', $catSandwiches, 0, 1, 0, 0, 0, 0, 7, $dryRun); insertItem($bizId, 'Grilled Chicken', 'Lettuce, tomato, and mayo', $catSandwiches, 0, 1, 0, 0, 0, 0, 8, $dryRun); insertItem($bizId, 'BBQ Chicken', 'Lettuce, tomato, and BBQ sauce', $catSandwiches, 0, 1, 0, 0, 0, 0, 9, $dryRun); insertItem($bizId, 'Fried Chicken', 'Lettuce, tomato, and mayo', $catSandwiches, 0, 1, 0, 0, 0, 0, 10, $dryRun); insertItem($bizId, 'Chicken Caesar Wrap', '', $catSandwiches, 0, 1, 0, 0, 0, 0, 11, $dryRun); $actions[] = ['step' => 'ITEMS', 'category' => 'Sandwiches', 'count' => 11]; // Soups & Salads $catSoups = insertItem($bizId, 'Soups & Salads', '', 0, 0, 1, 0, 0, 0, 0, 4, $dryRun); $actions[] = ['step' => 'CATEGORY', 'name' => 'Soups & Salads', 'id' => $catSoups]; insertItem($bizId, 'New England Clam Chowder', '', $catSoups, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Chili Bowl', 'With Cheese and Onion', $catSoups, 0, 1, 0, 0, 0, 0, 2, $dryRun); $salad1 = insertItem($bizId, 'Beach Salad', 'Spring mix greens, tomatoes, cucumbers, feta cheese, and carrots served in a crisp flour tortilla shell', $catSoups, 0, 1, 0, 0, 0, 0, 3, $dryRun); linkTemplate($salad1, $tplDressing, 1, $dryRun); linkTemplate($salad1, $tplSaladProtein, 2, $dryRun); $salad2 = insertItem($bizId, 'Caesar Salad', 'Romaine lettuce, croutons, and Caesar dressing', $catSoups, 0, 1, 0, 0, 0, 0, 4, $dryRun); linkTemplate($salad2, $tplSaladProtein, 1, $dryRun); $actions[] = ['step' => 'ITEMS', 'category' => 'Soups & Salads', 'count' => 4]; // Tacos $catTacos = insertItem($bizId, 'Tacos', 'Served two per order on flour tortillas unless otherwise noted', 0, 0, 1, 0, 0, 0, 0, 5, $dryRun); $actions[] = ['step' => 'CATEGORY', 'name' => 'Tacos', 'id' => $catTacos]; insertItem($bizId, 'Grilled Chicken Tacos', 'Taco sauce, cheese, lettuce, tomatoes, and ranch', $catTacos, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Fried Fish Tacos', 'Taco sauce, cheese, lettuce, tomatoes, and ranch', $catTacos, 0, 1, 0, 0, 0, 0, 2, $dryRun); insertItem($bizId, 'Mahi Mahi Tacos', 'Cheese, cabbage, and tomatoes on corn tortillas with a side of guacamole and salsa', $catTacos, 0, 1, 0, 0, 0, 0, 3, $dryRun); insertItem($bizId, 'Steak Fajita Tacos', 'Grilled with peppers, onions, and a side of cheese, tomatoes, and lettuce', $catTacos, 0, 1, 0, 0, 0, 0, 4, $dryRun); insertItem($bizId, 'Shrimp Fajita Tacos', 'Grilled with peppers, onions, and a side of cheese, tomatoes, and lettuce', $catTacos, 0, 1, 0, 0, 0, 0, 5, $dryRun); $actions[] = ['step' => 'ITEMS', 'category' => 'Tacos', 'count' => 5]; // Seafood $catSeafood = insertItem($bizId, 'Seafood', '', 0, 0, 1, 0, 0, 0, 0, 6, $dryRun); $actions[] = ['step' => 'CATEGORY', 'name' => 'Seafood', 'id' => $catSeafood]; insertItem($bizId, 'Fried Fantail Shrimp', 'With Fries', $catSeafood, 0, 1, 0, 0, 0, 0, 1, $dryRun); insertItem($bizId, 'Clam Boat with Fries', '', $catSeafood, 0, 1, 0, 0, 0, 0, 2, $dryRun); $seafood3 = insertItem($bizId, 'Fish and Chips', '', $catSeafood, 0, 1, 0, 0, 0, 0, 3, $dryRun); linkTemplate($seafood3, $tplPortion, 1, $dryRun); insertItem($bizId, 'Grilled Shrimp & Baby Scallop Skewers', '', $catSeafood, 0, 1, 0, 0, 0, 0, 4, $dryRun); $actions[] = ['step' => 'ITEMS', 'category' => 'Seafood', 'count' => 4]; // Hot Dogs & Such $catHotDogs = insertItem($bizId, 'Hot Dogs & Such', '', 0, 0, 1, 0, 0, 0, 0, 7, $dryRun); $actions[] = ['step' => 'CATEGORY', 'name' => 'Hot Dogs & Such', 'id' => $catHotDogs]; $hotdog1 = insertItem($bizId, 'Hot Dog', 'Topped with onions, tomatoes, and relish', $catHotDogs, 0, 1, 0, 0, 0, 0, 1, $dryRun); linkTemplate($hotdog1, $tplHotDogExtras, 1, $dryRun); insertItem($bizId, 'Corn Dog', '', $catHotDogs, 0, 1, 0, 0, 0, 0, 2, $dryRun); $hotdog3 = insertItem($bizId, 'Chili Dog', 'Topped with all beef chili', $catHotDogs, 0, 1, 0, 0, 0, 0, 3, $dryRun); linkTemplate($hotdog3, $tplHotDogExtras, 1, $dryRun); $actions[] = ['step' => 'ITEMS', 'category' => 'Hot Dogs & Such', 'count' => 3]; // Summary if (!$dryRun) { $qCount = queryOne("SELECT COUNT(*) AS cnt FROM Items WHERE BusinessID = ?", [$bizId]); $totalItems = (int)$qCount['cnt']; $qTemplateCount = queryOne("SELECT COUNT(*) AS cnt FROM Items WHERE BusinessID = ? AND ParentItemID = 0 AND IsCollapsible = 1", [$bizId]); $templateCount = (int)$qTemplateCount['cnt']; $qLinkCount = queryOne("SELECT COUNT(*) AS cnt FROM lt_ItemID_TemplateItemID tl JOIN Items i ON i.ID = tl.ItemID WHERE i.BusinessID = ?", [$bizId]); $linkCount = (int)$qLinkCount['cnt']; } else { $totalItems = 'N/A (dry run)'; $templateCount = 'N/A (dry run)'; $linkCount = 'N/A (dry run)'; } jsonResponse([ 'OK' => true, 'DryRun' => $dryRun, 'BusinessID' => $bizId, 'TotalItems' => $totalItems, 'TemplateCount' => $templateCount, 'TemplateLinkCount' => $linkCount, 'Actions' => $actions, ]);