// Fix Big Dean's - remove the fake "category" items that are actually modifier templates // The real categories start at ItemID 11271 (World Famous Burgers) bizId = 27; // These are the modifier template parent items that got created incorrectly as root items // They should NOT be categories - they're modifier group headers fakeCategories = [11177, 11180, 11183, 11186, 11190, 11193, 11196, 11199, 11204, 11212, 11220, 11259]; // Deactivate these items (or we could delete them, but deactivate is safer) for (itemId in fakeCategories) { queryExecute(" UPDATE Items SET IsActive = 0 WHERE ItemID = :itemId AND BusinessID = :bizId ", { itemId: itemId, bizId: bizId }, { datasource: "payfrit" }); } // Also deactivate their children (modifier options that belong to these fake parents) for (itemId in fakeCategories) { queryExecute(" UPDATE Items SET IsActive = 0 WHERE ParentItemID = :itemId AND BusinessID = :bizId ", { itemId: itemId, bizId: bizId }, { datasource: "payfrit" }); } // Now verify what categories remain qCategories = queryExecute(" SELECT i.ID, i.Name FROM Items i WHERE i.BusinessID = :bizId AND i.ParentItemID = 0 AND i.IsActive = 1 AND i.IsCollapsible = 0 AND NOT EXISTS (SELECT 1 FROM lt_ItemID_TemplateItemID tl WHERE tl.TemplateItemID = i.ID) ORDER BY i.SortOrder ", { bizId: bizId }, { datasource: "payfrit" }); categories = []; for (row in qCategories) { arrayAppend(categories, { "ItemID": row.ID, "Name": row.Name }); } writeOutput(serializeJSON({ "OK": true, "MESSAGE": "Deactivated #arrayLen(fakeCategories)# fake category items and their children", "remainingCategories": categories }));