LoginSignup
2
2

More than 5 years have passed since last update.

CS-Cart: 通知関数fn_set_notificationの使い方

Last updated at Posted at 2016-01-12

CS-Cartでは、処理の成功・失敗などをUIにフィードバックできる通知(notification)の機構がある。Ruby on Railsなどのフレームワークでよく見かけるflash的なものだ。

この通知は、fn_set_notificationを実行すると使うことができる。

fn_set_notification

通知関数の引数などは次のようになっている。

/**
 * Sets notification message
 *
 * @param string $type notification type (E - error, W - warning, N - notice, O - order error on checkout, I - information)
 * @param string $title notification title
 * @param string $message notification message
 * @param string $message_state (S - notification will be displayed unless it's closed, K - only once, I - will be closed by timer)
 * @param mixed $extra extra data to save with notification
 * @param bool $init_message $title and $message will be processed by __ function if true
 * @return boolean always true
 */
function fn_set_notification($type, $title, $message, $message_state = '', $extra = '', $init_message = false)

サンプル

fn_set_notification('E', __('error'), '失敗しました');
fn_set_notification('W', __('important'), '注意してください');
fn_set_notification('W', __('warning'), '注意してください');
fn_set_notification('N', __('notice'), '成功しました');
fn_set_notification('N', __('congratulations'), 'ついに成功しました');
fn_set_notification('S', __('notice'), 'アップデートがあります');
fn_set_notification('W', __('warning'), '問題が有ります。<a href="#">詳しく</a>');

Screen Shot 2016-01-12 at 18.21.25.png

2
2
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
2
2