> For the complete documentation index, see [llms.txt](https://docs.cs-cart.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cs-cart.jp/addon-development/addon-directories.md).

# アドオンのディレクトリ構造

## アドオンの必須ファイル・ディレクトリ

*app/addons/<アドオン名>* ディレクトリは、すべてのアドオンに必須です。\
テンプレートを除くすべてのアドオンファイルは、次のディレクトリに存在しなくてはなりません。

* `addon.xml`-アドオンのインストールやアンインストールに必要なアドオンについてのデータを記述します。
* `func.php`-アドオンのコントローラーなどで使用する関数が記述されています。このファイルに書いた関数はテンプレートなどからも利用可能です。
* `init.php`-アドオンで使用するPHPフックのリストの登録を行うファイルです。
* `config.php`-アドオンの設定データが格納されています。（定数の宣言など）
* `var/langs/<言語コード>/addons/<アドオン名>.po` アドオンでの言語変数

次のディレクトリも必要に応じて準備する必要があるかもしれません。

* `controllers`-このディレクトリには、アドオンコントローラーのファイルと、コアのコントローラーを拡張するPREコントローラーとPOSTコントローラーのファイルが含まれます。
* `schemas` -標準のスキーマーを拡張するファイルを含むディレクトリ。

## 追加のテンプレートディレクトリ

アドオンは、上記のディレクトリに加えて次のテンプレート用のディレクトリを使用できます。

* `var/themes_repository/basic/templates/addons/<アドオン名>` - ショップフロントのテンプレート
* `design/backend/templates/addons/<アドオン名>` - 管理パネルテンプレート
* `var/themes_repository/basic/mail/templates/addons/<アドオン名>` - メールテンプレート

{% hint style="info" %}
TIPS

開発者の裁量で、これらディレクトリにさらにサブディレクトリやファイルを作成できます。プリインストールされている他のアドオンを確認することをお勧めします。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.cs-cart.jp/addon-development/addon-directories.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.
