[[CS-Cartめも]] Cs-Cartでカスタマイズを行いたい場合は、コアファイルは改変せずにアドオンをインストールすることで対応します。~ コアファイルは app/functions/ 以下に配置されています。 app/addons/ 以下にアドオンごとにフォルダ分けして配置し、管理画面からインストールを行います。 *フックポイント [#ta815541] Cs-CartではPHPコード内で用意されている''PHPフック''と、Smarty内で用意されている''テンプレートフック''の2種類のフックポイントがあります。 自身でアドオンを作成する場合は、これらのフックポイントをフックすることでカスタマイズを入れて行くことになります。 フックポイントは[[Hooks base:http://www.cs-cart.com/api]]で検索することができます。~ *設定ファイル [#w651df12] アドオンには必ず設定ファイルが必要になります。~ hello_worldアドオンを作成する場合は、以下に addon.xmlファイルを作成します。 app/addons/hello_world/addon.xml <?xml version="1.0"?> <addon scheme="3.0"> <id>hello_world</id> <version>1.0</version> <priority>100500</priority> <settings edition_type="ROOT,ULT:VENDOR"> <sections> <section id="general"> <items> <item id="some_prop"> <type>input</type> <default_value>Hello World!</default_value> </item> <item id="some_dropdown"> <type>selectbox</type> <default_value>blue</default_value> <variants> <item id="red"></item> <item id="green"></item> <item id="blue"></item> </variants> </item> </items> </section> </sections> </settings> <position>0</position> <status>active</status> <default_language>en</default_language> <auto_install>MULTIVENDOR,ULTIMATE</auto_install> </addon> フォルダ名とidは一致させる必要があります。 これだけで管理画面から アドオン - アドオンの管理 - 利用可能なすべてのアドオンを表示 にて作成したアドオンのインストールが可能になります。 *言語ファイル [#jfe272b9] 多言語対応のため、gettextによるpoファイルで管理されています。 英語の場合は /var/langs/en/addons/hello_world.po~ 日本語の場合は /var/langs/ja/addons/hello_world.po~ にそれぞれ配置することになります。 設定ファイルとは別の場所になるので要注意です。~ アドオンごとに同一フォルダにまとめられないのが気持ち悪い… var/langs/en/addons/hello_world.po msgid "" msgstr "Project-Id-Version: tygh" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: English\n" "Language: en_US\n" msgctxt "Addons::name::hello_world" msgid "Hello World" msgstr "Hello World" msgctxt "Addons::description::hello_world" msgid "Say hello to the world." msgstr "Say hello to the world." msgctxt "SettingsOptions::hello_world::some_prop" msgid "Some Prop" msgstr "Some Prop" msgctxt "SettingsOptions::hello_world::some_dropdown" msgid "Some Dropdown" msgstr "Some Dropdown" msgctxt "SettingsVariants::hello_world::some_dropdown::red" msgid "Red" msgstr "Red" msgctxt "SettingsVariants::hello_world::some_dropdown::green" msgid "Green" msgstr "Green" msgctxt "SettingsVariants::hello_world::some_dropdown::blue" msgid "Blue" msgstr "Blue" var/langs/ja/addons/hello_world.po msgid "" msgstr "Project-Id-Version: tygh" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Japanese\n" "Language: ja_JP\n" msgctxt "Addons::name::hello_world" msgid "Hello World" msgstr "ハローワールド" msgctxt "Addons::description::hello_world" msgid "Say hello to the world." msgstr "ハローワールド!" msgctxt "SettingsOptions::hello_world::some_prop" msgid "Some Prop" msgstr "何かの設定" msgctxt "SettingsOptions::hello_world::some_dropdown" msgid "Some Dropdown" msgstr "何かのドロップダウン" msgctxt "SettingsVariants::hello_world::some_dropdown::red" msgid "Red" msgstr "赤" msgctxt "SettingsVariants::hello_world::some_dropdown::green" msgid "Green" msgstr "緑" msgctxt "SettingsVariants::hello_world::some_dropdown::blue" msgid "Blue" msgstr "青" これでインストールすると、基本設定から値を変更することができるようになります。