LoginSignup
4
4

More than 5 years have passed since last update.

CS-Cart:管理画面にメニューを追加する方法

Posted at

CS-Cartで管理画面にメニューを追加する方法です。CS-Cartでは、いろいろな場所にメニューを追加できますが、今回は注文や商品があるメニューに追加する方法を紹介します。

Screen_Shot_2016-02-07_at_14_28_34.png

まず、アドオンにメニュー定義ファイル menu.post.php を作成します。このファイルはCS-Cartに自動的に読み込まれるので、置くだけでOKです。変数$schemaが渡ってくるので、ここに足したいメニューを追加します。

/app/addons/[addon-id]/schemas/menu/menu.post.php
<?php

/** @var $schema array */
$schema['central']['foo'] = [
    'position' => 700,
    'items' => [
        'bar' => [
            'href' => 'bar.manage',
            'position' => 100,
        ],
    ],
];

return $schema;

$schema['central']は灰色のメニューの配列です。灰色の部分にメニューを足したい場合は、これに要素を追加します。

翻訳は$schema['central']['foo']foo$schema['central']['foo']['items']['bar']barに名前で対応したものを用意します。

msgctxt "Languages::foo"
msgid "Foo"
msgstr "ふー"

msgctxt "Languages::bar"
msgid "Bar"
msgstr "ばー"

msgctxt "Languages::bar_menu_description"
msgid "Description of Bar"
msgstr "ばーの説明"
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4