1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CS-CartのPHPフックで捕まえた引数を書き換える方法

Last updated at Posted at 2018-07-23

※CS-Cart初心者+フック管理に馴染みがない人が書いています。

・検索しても中々出てこなかったので、メモ書きします。

アドオンに必要な「addon.xml」「init.php」「アドオン名.po」は割愛します。

func.php

<?php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

/*

このアドオンは「get_currencies_list_post」フックを使って
言語が英語で日本円が来た場合、表示を「Yen」に変えるアドオンです。
*/
function fn_yen_symbol_get_currencies_list_post($params, $area, $lang_code, &$currencies)
{

    if($lang_code == 'en'){
        //ここで$currenciesを書き換えている
        $currencies['JPY']['symbol'] = 'Yen';
    }

}

注目してほしいところは&$currenciesの所です。

引数に*&*を付けることでその引数を更新することが出来ます。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?