# Categories

## 📂 Categories

ELENASHOP comes with 6 built-in categories plus an All view that groups items by category.

***

### Built-in Categories

| ID          | Label       | Icon        | Color  |
| ----------- | ----------- | ----------- | ------ |
| food        | Food        | Utensils    | Yellow |
| drink       | Drinks      | Wine Bottle | Cyan   |
| tools       | Tools       | Wrench      | Purple |
| electronics | Electronics | Mobile      | Blue   |
| medical     | Medical     | First Aid   | Red    |
| other       | Other       | Box         | Green  |

***

### Category Configuration

Categories are defined in shared/config.lua:

Config.Categories = { { id = 'all', label = 'ui\_all', icon = 'fas fa-border-all' }, { id = 'food', label = 'ui\_food', icon = 'fas fa-utensils' }, { id = 'drink', label = 'ui\_drink', icon = 'fas fa-wine-bottle' }, { id = 'tools', label = 'ui\_tools', icon = 'fas fa-wrench' }, { id = 'electronics', label = 'ui\_electronics', icon = 'fas fa-mobile-alt' }, { id = 'medical', label = 'ui\_medical', icon = 'fas fa-first-aid' }, { id = 'other', label = 'ui\_other', icon = 'fas fa-box-open' }, }

***

### Adding a New Category

#### Step 1: Add to Config

Config.Categories = { -- existing categories... { id = 'weapons', label = 'ui\_weapons', icon = 'fas fa-crosshairs' }, }

#### Step 2: Add Locale String

In shared/locales.lua:

\-- Turkish Locales\['tr']\['ui\_weapons'] = 'Silahlar'

\-- English Locales\['en']\['ui\_weapons'] = 'Weapons'

#### Step 3: Add CSS Color (Optional)

In html/style.css add color for the new category:

.category-icon-box\[data-cat="weapons"] { background: rgba(255, 100, 0, 0.15); color: #ff8c00; }

.category-item.active .category-icon-box\[data-cat="weapons"] { background: #ff6400; color: white; }

.category-group-icon\[data-cat="weapons"] { background: rgba(255, 100, 0, 0.15); color: #ff8c00; }

#### Step 4: Use in Store Items

items = { { name = 'weapon\_pistol', label = 'Pistol', price = 5000, category = 'weapons', stock = 5 }, }

***

### All View Behavior

When All category is selected:

* Items are grouped by category with headers
* Each group has its colored icon and item count
* Groups are shown in the order defined in Config.Categories
* Empty categories are hidden automatically

When a specific category is selected:

* Only items from that category are shown
* Displayed in a flat grid without group headers

Categories without any items are automatically hidden from the sidebar.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://elena-scripts.gitbook.io/elenascripts/economy/shop/categories.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
