
Duda
Implementation Guide
The following document provides guidance on unique challenges discussed around your implementation.
Readonly Menu Connection/Custom Widget
An exciting feature of Lunchbox powered websites will be the integrated menu. Restaurants can update their online ordering menus directly in Lunchbox and have their website menu stay in sync with the changes. An API GET endpoint containing the menu data can be used as a data source to a Duda collection. A custom widget can be used to then display the items and provide the user with customization options to match their brand.
The collection and the custom widget can be embedded within the site template. When a site is created from one of the template, an update collection call can be made to point to live customer data.
Menu Endpoint (Example)
{
sections: [{
name: 'Appetizers',
id: 1,
items: [{
name: 'Flatbread',
id: 10,
price: 9.0
}, {
name: 'Wings',
id: 11,
price: 10.00
}]
}, {
name: 'Sides',
id: 2,
items: [{
name: 'Fries',
id: 12,
price: 7.00
}, {
name: 'Rings',
id: 13,
price: 8.00
}]
}]
}
The endpoint can be used as a data source of a Duda external collection. Each menu should be available at a unique URL either by a path segment or query parameter e.g., /customers/1/menu or /menus?customer=1
Update an External Collection
curl --request PUT \
--url https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name} \
--header 'authorization: Basic ABC123' \
--header 'content-type: application/json' \
--data '{ external_details: { enabled: true, external_endpoint: 'https://domain.com/customer/1/menus', collection_data_json_path: 'sections', page_item_url_field: 'id' }, name: 'menus' }'
Setting up a 'placeholder' collection (Static JSON data) within the templates will allow designers to complete a design with dummy data. At site creation, all that is needed is to point the collection to live customer data.