'Tiệm Bánh Mai', // From the OnDuty console, tab Trợ lý, "Tạo mã bí mật". Anyone holding it can sign requests: keep it here only. 'secret' => 'odc_...', // Optional: your OnDuty shop id. When set, a request signed for another shop is refused. 'tenant' => '', // The site's public address. Fact URLs are built from it. 'site' => 'https://tiembanhmai.vn', // How long (seconds) OnDuty may reuse an answer for the same question. OnDuty caps it at 300. 'ttl' => 60, // Seconds a signed request stays valid. Protects against a captured request being replayed later. 'replay_window' => 300, // A connection to your database. Throw on failure so the connector answers "database error" cleanly. 'db' => function () { $db = new mysqli('localhost', 'db_user', 'db_password', 'db_name'); if ($db->connect_error) { throw new Exception('db connect: ' . $db->connect_error); } $db->set_charset('utf8'); return $db; }, // What the assistant may search. ONLY tables whose every row is already public on your website. // The kit refuses names that look private (member, user, order, customer, admin, password...). 'sources' => array( array( 'id' => 'products', 'table' => 'products', // Columns searched, with weights: a word found in the name counts three times one in the description. 'search' => array('name' => 3, 'code' => 2, 'description' => 1), // Extra columns read to build the answer. 'select' => array('slug', 'price', 'sale_price'), // Fixed conditions: only rows the website shows. 'where' => array('is_active' => 1), // Enables "rẻ nhất" (cheapest first). 'price_column' => 'price', 'weight' => 1.5, 'title' => '{name}', // A template like '{name}: {price}', or a function that receives the row. 'body' => function ($r) { $price = onduty_money($r['sale_price']) ?: onduty_money($r['price']); $parts = array($price !== '' ? 'giá ' . $price : 'giá liên hệ'); if ($r['code'] !== '') { $parts[] = 'mã ' . $r['code']; } $parts[] = onduty_text($r['description'], 300); return implode(', ', $parts); }, // Page address of one row. {id} lets the kit recognise "the page the visitor is on". 'url' => 'san-pham/{slug}-{id}.html', ), ), // Facts that are always true, returned when one of their keywords is in the question. 'facts' => array( array( 'title' => 'Liên hệ', 'body' => 'Hotline/Zalo 0900 000 000, mở cửa 8h-21h mỗi ngày, 12 Nguyễn Trãi, Quận 1.', 'keywords' => array('hotline', 'số điện thoại', 'liên hệ', 'zalo', 'địa chỉ', 'mở cửa', 'giờ'), ), ), // Only if a table or column the guard refuses is genuinely public, e.g. a "user_guides" table. 'allow_names' => array(), );