> 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/core/shop-front/dynamic-objects.md).

# Dynamic Objects

詳細ページのブロックに対して異なるコンテンツとステータスを持つことができるオブジェクトは、ブロックマネージャーでDynamicオブジェクトとみなされます。\
動的オブジェクトには、`Products`、`Pages`、`Categories`、`Vendors`、および`News`の 5つがデフォルトのタイプとして定義されています。

{% hint style="success" %}
HINT

`Vendors`はマーケットプレイス版でのみ利用可能です
{% endhint %}

## Dynamicオブジェクトを使用する理由

`Products` （商品）を例としてみましょう。他のDynamicオブジェクトも同じように機能します。

商品編集ページでブロックのコンテンツを変更すると、その商品のみでコンテンツが保存されます。ブロックのコンテンツを編集すると、コンテンツが変更された場所が下に表示されます。追加のチェックボックスも表示され、そのチェックボックスをオンにすると、変更したコンテンツをグローバルに適用できます。

商品の編集ページでブロックを有効または無効にすると、ブロックの状態はその商品に対してのみ保存されます。

ブロックマネージャーで`dispatch=products.view`を使用してロケーションのブロックを編集すると、ステータスタブを使用して、特定の商品のブロックを有効または無効にできます（グローバルに無効または有効になっている場合であっても可能です。）

## Dynamicオブジェクトの仕組み

`dynamic_objects.php`でオブジェクトについて記述すると、Dynamicオブジェクトが自動的に作成されます。`dynamic_objects`スキーマに新しいオブジェクトを追加できます。商品の説明文は次のようになります。

```php
array(
    // 動的オブジェクトの名前
    'products' => array (
        // 動的オブジェクトの編集ページ。これは、管理パネルで[ブロック]タブが表示されるページです。
        'admin_dispatch' => 'products.update',
        // カスタマーゾーンのページのアドレスと、ダイナミックオブジェクトを操作できるブロックコントロールペイン
        'customer_dispatch' => 'products.view',
        // ブジェクトの識別子を定義する$_REQUEST配列のキー 
        'key' => 'product_id',
        // 管理画面で使用されるピッカーの設定
        'picker' => 'pickers/products/picker.tpl',
        'picker_params' => array (
            'type' => 'links',
        ),
    ),
)
```

ショップのユーザーが`dispatch=products.view`でページをリクエストすると、CS-Cart\
はそのページが商品のDynamicオブジェクトに属していると判断し、スクリプトに渡されたパラメーターの`product_id`を探します。\
`product_id`がある場合、ページを生成するすべてのデータは、ブロックAPI、もしくは指定されたタイプおよび識別子を介してリクエストされます。

パラメーターまたはブロックのタイプが`dispatch`によって判断できなかった場合、データはグローバルパラメーターを使用して、動的オブジェクトなしで生成されます。


---

# 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/core/shop-front/dynamic-objects.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.
