Products
A table, badges and an alert, all driven by lists and conditions.
✅ Desk lamp was added to your cart.
Dismiss
| Product | Price | Availability | |
|---|---|---|---|
| 📓 Notebook | $4.50 | In stock | Add to cart |
| 🖋️ Fountain pen | $12.50 | Sold out | |
| 🎒 Backpack | $39.00 | Only 3 left | Add to cart |
| 💡 Desk lamp | $19.00 | In stock | Add to cart |
| 🎧 Headphones | $89.00 | Only 1 left | Add to cart |
| Subtotal | $164.00 | ||
| Tax (20%) | $32.80 | ||
| Total for one of everything | $196.80 | ||
Cheapest and dearest
Cheapest
Notebook at $4.50
Dearest
Headphones at $89.00
The whole table is this loop
for each product in names
set position to position + 1
set price to item position of prices
set left to item position of stock
set subtotal to subtotal + price
if left is 0
show "<span class='badge theme-danger'>Sold out</span>"
otherwise if left is less than 5
show "<span class='badge theme-warning'>Only [left] left</span>"
otherwise
show "<span class='badge theme-success'>In stock</span>"
end
end