环境搭建好了。运行测试环境的一些问题。

bug问题 · lwj4126380 · 于 6年前 发布 · 2842 次阅读

在首页选择语言(比如中文),货币没有变成对应(比如选择中文变成CNY)。请问,这是正常现象吗?

下面是我的配置,按照安装视频中来的:

        'www.fecshoptest.com/cn' => [
            'language'         => 'zh_CN',
            'languageName'     => '中文',
            'localThemeDir'    => '@appfront/theme/terry/theme01',
            'thirdThemeDir'    => [],
            'currency'         => 'CNY',
            'mobile'           => [
                'enable'            => false,
                'condition'         => ['phone', 'tablet'],
                'redirectDomain'    => 'fecshop.apphtml5.fancyecommerce.com/cn',
                'https'             => false,  // 手机端url是否支持https,如果支持,设置https为true,如果不支持,设置为false
            ],
            // 第三方账号登录配置
            'thirdLogin' => [
                // facebook账号登录
                'facebook' => [       //fb api配置 ,fb可以一个app设置pc和手机web两个域名
                    'facebook_app_id'     => '108618299786621',
                    'facebook_app_secret' => '420b56da4f4664a4d1065a1d31e5ec73',
                ],
                // google账号登录
                'google' => [       //谷歌api visit https://code.google.com/apis/console to generate your google api
                    'CLIENT_ID'      => '380372364773-qdj1seag9bh2n0pgrhcv2r5uoc58ltp3.apps.googleusercontent.com',
                    'CLIENT_SECRET'  => 'ei8RaoCDoAlIeh1nHYm0rrwO',
                ],
            ],
            'sitemapDir' => '@appfront/web/cn/sitemap.xml',
        ],
共收到 4 条回复 问题提问
Fecmall#16年前 0 个赞

1.每个store对应一个语言,这个是一一对应的,切换到store,语言就会变成相应的语言。

2.每个store有一个默认的货币,网站第一次访问,货币默认使用的是该货币

3.如果访问后,切换成其他的store,语言会改变,货币不会改变,因为,我在中文store下,我同样可以查看美元,欧元等其他语言的货币,而不仅仅RMB

4.对于你的 www.fecshoptest.com/cn, 你如果把session cookie清空,然后访问,就会发现货币是RMB

对于这部分的代码可以参看 https://github.com/fecshop/yii2_fecshop/blob/master/services/Store.php

/*
 * init store currency.
 */
if (isset($store['currency']) && !empty($store['currency'])) {
$currency = $store['currency'];
} else {
$currency = '';
}
Yii::$service->page->currency->initCurrency($currency);

https://github.com/fecshop/yii2_fecshop/blob/master/services/page/Currency.php

/**
     * @property $currencyCode | 货币简码
     * 初始化货币信息,在service Store bootstrap(Yii::$app->store->bootstrap()), 中会被调用
     * 1. 如果 $this->defaultCurrency 和 $this->baseCurrecy 没有设置,将会报错。
     * 2. 如果 传递参数$currencyCode为空,则会使用默认货币
     */
    protected function actionInitCurrency($currencyCode = '')
    {
        if (!$this->defaultCurrency) {
            throw new InvalidConfigException('defautlt currency must config');
        }
        if (!$this->baseCurrecy) {
            throw new InvalidConfigException('base currency must config');
        }
        if (!$this->getCurrentCurrency()) {
            if (!$currencyCode) {
                $currencyCode = $this->defaultCurrency;
            }
            $this->setCurrentCurrency($currencyCode);
        }
    }
lwj4126380#26年前 1 个赞

好的。了解了! 感谢详细的解释! 刚才测试了一下,发现清空cookie后就如您所说。一切正常。非常感谢!

LHTong#33年前 0 个赞

你好请问,清空cookie,是清除浏览器的吗

Fecmall#43年前 0 个赞

@LHTong #3楼 是的。

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics