Fecmall

第 2 位会员

会员
个人信息
  • 加入于 2017-05-31 17:38:45
  • 城市 Qingdao
  • GitHub https://github.com/fecshop
  • 最后登录时间 12天前
  • 签名 净化自己,潜心编码
个人简介
Terry,Fecmall开源产品作者,12年电商经验一线程序员开发者,擅长规划产品,架构设计。
个人成就
  • 发表文章次数 744
  • 发布回复次数 5760
  • 个人主页浏览次数 683
Connection could not be established with host smpt.qq.com7年前

这个是发送邮件的报错(host smpt.qq.com),可以参看地址:fecshop邮件

fecshop的配置文件为:@fecshop/config/services/Email.php ,在这个配置文件里面你可以看到:

// 各个邮件的模板部分:
                'emailTheme' => [
                    // 注册账户发送的邮件的模板配置
                    'register' => [
                        'enable' => true,
                        // 邮件内容的动态数据提供部分
                        'widget'        => 'fecshop\services\email\widgets\customer\account\register\Body',
                        // 邮件内容的view部分
                        'viewPath'        => '@fecshop/services/email/views/customer/account/register',
                        

这个错误是smtp发送邮件导致的,您可以到@common/config/fecshop_local_services/Email.php 中更改smtp为您的smtp配置。

或者将register注册发送邮件功能关掉,具体步骤为:通过配置覆盖的方式,将@fecshop/config/services/Email.php的上面的代码,复制到@common/config/fecshop_local_services/Email.php ,@common的配置在初始化的时候会覆盖@fecshop的配置

@common/config/fecshop_local_services/Email.php

添加前的代码为:

<?php
/**
 * FecShop file.
 *
 * @link http://www.fecshop.com/
 *
 * @copyright Copyright (c) 2016 FecShop Software LLC
 * @license http://www.fecshop.com/license/
 */
return [
    'email' => [
        'mailerConfig' => [
            // 默认通用配置
            'default' => [
                'class'     => 'yii\swiftmailer\Mailer',
                'transport' => [
                    'class'       => 'Swift_SmtpTransport',
                    'host'        => 'smtp.qq.com',            //SMTP Host
                    'username'    => '2420577683@qq.com',   //SMTP 账号
                    'password'    => 'zdveeweuevnldjgd',    //SMTP 密码
                    'port'        => '587',                    //SMTP 端口
                    'encryption'  => 'tls',
                ],
                'messageConfig'=> [
                   'charset'=> 'UTF-8',
                ],
            ],
        ],
    ],
];

添加后的代码为:

<?php
/**
 * FecShop file.
 *
 * @link http://www.fecshop.com/
 *
 * @copyright Copyright (c) 2016 FecShop Software LLC
 * @license http://www.fecshop.com/license/
 */
return [
    'email' => [
        'mailerConfig' => [
            // 默认通用配置
            'default' => [
                'class'     => 'yii\swiftmailer\Mailer',
                'transport' => [
                    'class'       => 'Swift_SmtpTransport',
                    'host'        => 'smtp.qq.com',            //SMTP Host
                    'username'    => '2420577683@qq.com',   //SMTP 账号
                    'password'    => 'zdveeweuevnldjgd',    //SMTP 密码
                    'port'        => '587',                    //SMTP 端口
                    'encryption'  => 'tls',
                ],
                'messageConfig'=> [
                   'charset'=> 'UTF-8',
                ],
            ],
        ],
        
        'childService' => [
            /*
             * 用户中心部分的邮件的设置。
             */
            'customer' => [
                'class' => 'fecshop\services\email\Customer',

                // 各个邮件的模板部分:
                'emailTheme' => [
                    // 注册账户发送的邮件的模板配置
                    'register' => [
                        'enable' => false,
                    ],
                ],
            ],
        ],
    ],
];

关于fecshop配置的原理,可以参看:Fecshop 配置结构

在上面可以看到,把register部分的功能 enable设置成false,进而关掉了注册账号发送邮件,

对于其他地方的发送邮件,都可以通过这种方式进行关闭邮件的发送。

如果要开启邮件发送,必须配置smtp

fancyecommerce文件夹下的fec_admin文件夹的功能是什么7年前

Yii2 和 DWZ UI(jui) 集成的后台框架

appfront中首页对应的Controller是哪个?7年前

@xiaobeibei #2楼 仔细看我的回复。

'rules' => [
                '' => 'cms/home/index',
            ],
appfront中首页对应的Controller是哪个?7年前

pc 端 的首页对应的controller是哪一个?

打开文件@fecshop/app/appfront/config/appfront.php,可以看到代码

// 首页对应的url
        'urlManager' => [
            'rules' => [
                '' => 'cms/home/index',
            ],
        ],

也就是对应的urlkey为 cms/home/index , 因此就是文件

fecshop\app\appfront\modules\Cms\controllers\HomeController actionIndex()

composer下载 fecshop 出错:Project directory fecshop/ is not empty7年前

对于多语言站点,需要配置文件: @app\config\fecshop_local_services\Store.php 中设置的

譬如:(这个在文档里面都有的,你不去看:http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-about-config.html)

<?php
   return [
   'store' => [
		'class' => 'fecshop\services\Store',
		'stores' => [
			# 数据的key就是域名
			'appfront.fecshoptest.com' => [
				'language' 		=> 'en_US',   # 语言必须在上面第五步的fecshoplang中定义,否则将无法得到语言属性。
				'languageName' 	=> 'English', # 在添加store的时候,必须查看 添加的语言在 fecshoplang中是否定义。
				# 定义本地模板路径,用来重写fecshop的模板,或者开发新的模板文件。
				//'localThemeDir'	=> '@appfront/theme/terry/theme01',
				# 定义第三方模板路径,用来重写fecshop的模板,或者开发新的模板文件。
				'thirdThemeDir'	=> [],
				# 当前语言的默认货币,货币必须在上面第六步的配置中存在
				'currency' 		=> 'USD',
				'mobile'		=> [ # 当设备满足什么条件的时候,进行跳转。
					'enable'		=> true,
					'condition'		=> ['phone','tablet'], # phone 代表手机,tablet代表平板
					'redirectUrl' 	=> 'apphtml5.fecshoptest.com',	# 如果是移动设备访问进行域名跳转
				],
				# 第三方账号登录配置
				'thirdLogin' => [
					'facebook' =>[                       #fb api配置 ,fb可以一个app设置pc和手机两个域名 
						'facebook_app_id'     => '184963',
						'facebook_app_secret' => '2e097dd7139',
					],
					"google" => [                       #谷歌api visit https://code.google.com/apis/console to generate your google api
						'CLIENT_ID'  	 => '38037grhccontent.com',
						'CLIENT_SECRET'  => 'ei8RaoCHYm0rrwO',
					],
				]

				//'image'	=> [
				//	'domain' => 'img.appfront.fancyecommerce.com',
				//	'baseDir'=> '@appimage/appfront',
				//]
			],
			'appfront.fecshoptest.com/fr' => [
				'language' 		=> 'fr_FR',
				'languageName' 	=> 'Fran?ais',
				'localThemeDir'	=> '@appfront/theme/terry/theme01',
				'thirdThemeDir'	=> [],
				'currency' 		=> 'RMB',
				'mobile'		=> [
					'enable'			=> true,
					'condition'			=> ['phone'], # phone 代表手机,tablet代表平板。
					'redirectDomain' 	=> 'apphtml5.fecshoptest.com/fr', # 跳转后的url。
				],
			],
			'appfront.fecshoptest.es' => [
				'language' 		=> 'es_ES',
				'languageName' 	=> 'Espa?ol',
				'localThemeDir'	=> '@appfront/theme/terry/theme01',
				'thirdThemeDir'	=> [],
				'currency' 		=> 'USD',
				'mobile'		=> [
					'enable'		=> true,
					'condition'		=> ['tablet'],
					'redirectDomain' 	=> 'fecshop.apphtml5.es.fancyecommerce.com',	
				],
			],
			'appfront.fecshoptest.com/cn' => [
				'language' 		=> 'zh_CN',
				'languageName' 	=> '中文',
				'localThemeDir'	=> '@appfront/theme/terry/theme01',
				'thirdThemeDir'	=> [],
				'currency' 		=> 'RMB',
				'mobile'		=> [
					'enable'		=> false,
					'condition'		=> ['phone','tablet'],
					'redirectDomain' 	=> 'fecshop.apphtml5.fancyecommerce.com/cn',	
				],
			],
		],
		
	],
			
];

对于上面配置文件中的 stores数组,每一个子项,就是一个store的配置,譬如:appfront.fecshoptest.comappfront.fecshoptest.com/fr, 你可以在里面看到各个store具体譬如,譬如语言货币模板等设置。

如果您在nginx 将 域名 appfront.fecshoptest.com 设置到文件路径 @appfront/web 目录,那么您可以访问appfront.fecshoptest.com,对于appfront.fecshoptest.com/fr ,就是对应到 @appfront/web/fr 中。

您还可以在nginx将 appfront.fecshoptest.es 也对应到@appfront/web目录中。

有抓狂的感觉很正常,光Yii2框架,如果想玩精通了,怎么得一年的时间,如果没有底子,学习起来的确感觉很费劲,这很正常。

composer下载 fecshop 出错:Project directory fecshop/ is not empty7年前

@LOVE520 [#4楼](#comment4) 看文档嘛,main-local.php找不到,你不按照文档来操作

对于原来的composer安装,执行的命令如下:

composer global require "fxp/composer-asset-plugin:^1.3.1"
composer create-project fancyecommerce/fecshop-app-advanced  fecshop 1.0.3.3
cd fecshop
composer update    
./init

如果你使用的百度云盘的压缩包: 1.解压压缩包 2.进入压缩包文件夹 3.执行 ./init 命令,进行初始化文件。

就会生成main-local.php

你没有Yii2框架基础,可以先去玩玩Yii2框架。

关于fecshop中 appfront->config->fecshop_local_services中的php文件和@fecshop->services中的php文件的关系7年前

@xiaobeibei #7楼 知道原理就行了,那个是探究原理的代码

可以很简单的理解原理就行了,譬如:

配置:common\config\fecshop_local_services\Product.php

类:@fecshop\services\Product.php

容器方法:Yii::createObject($service);

容器的作用就是实例化类,生成一个对象,然后利用配置中的数组数据,对对象的属性依次赋值,就这么个原理,如果想了解本质,可以看看你发的那个文章。

关于fecshop中 appfront->config->fecshop_local_services中的php文件和@fecshop->services中的php文件的关系7年前

@xiaobeibei #5楼 容器注入, 上面写了,根据类和配置,生成一个单例模式的对象,放到Yii::$service的一个属性(这个属性是数组)里面,__get()方法会到这个属性里面取之前生成的对象,取不到就会生成,你先了解下yii框架把。

关于fecshop中 appfront->config->fecshop_local_services中的php文件和@fecshop->services中的php文件的关系7年前

这个是Yii2的容器注入,原理就是:吧一个类和一个配置数据扔给容器,容器给生成一个对象。

配置:common\config\fecshop_local_services\Product.php

类:@fecshop\services\Product.php

容器方法,也就是:Yii::createObject($service);

所有的service都继承于 [@fecshop](/member/fecshop)\services\Service 在这个类里面可以看到如下代码:

protected function getChildService($childServiceName)
    {
        if (!$this->_childService[$childServiceName]) {
            $childService = $this->childService;
            if (isset($childService[$childServiceName])) {
                $service = $childService[$childServiceName];
                $this->_childService[$childServiceName] = Yii::createObject($service);
            } else {
                throw new InvalidConfigException('Child Service ['.$childServiceName.'] is not find in '.get_called_class().', you must config it! ');
            }
        }

        return $this->_childService[$childServiceName];
    }

原理为使用php的魔术方法 __get() ,在上面的类中你可以看到这个魔术方法调用了 getChildService($childServiceName) , 这个函数里面调用了 Yii::createObject($service); 这个容器函数,来生成相应的对象。

上面说的就是容器生成的原理,Yii2的组件就是这个原理搞的,按照Yii::$app->xxxxx,进行调用组件,组件是单例模式,

fecshop参考了Yii2组件的原理,Yii::$service->xxxx 的方式调用service

对于每一个service的配置,一共有几个配置文件,在初始化的时候合并

@fecshop//config/services/Product.php : 这个配置文件是yii2对services的默认配置。

@common/config/fecshop_local_services/Product.php :如果你想全局重写Product services , 可以在 这个配置文件中更改配置

@appfront/config/fecshop_local_services/Product.php :如果你在单个入口重写 Product services,譬如在appfront中重写,您可以在 这个文件中更改配置,如果Product.php不存在,您可以新建一个配置文件。

这三个配置文件是有优先级的,高优先级的配置会覆盖低优先级的配置, @appfront @common [@fecshop ,优先级由高到低,

原理为:打开@app/web/index.php 可以看到代码:(@app 统称,代指 @appfront @apphtml5等)

$config = yii\helpers\ArrayHelper::merge(
        require(__DIR__.'/../../common/config/main.php'),
        require(__DIR__.'/../../common/config/main-local.php'),
        require(__DIR__.'/../config/main.php'),
        require(__DIR__.'/../config/main-local.php'),
        // fecshop services config
        require(__DIR__.'/../../vendor/fancyecommerce/fecshop/config/fecshop.php'),
        // fecshop module config
        require(__DIR__.'/../../vendor/fancyecommerce/fecshop/app/appfront/config/appfront.php'),

        // thrid part confing

        // common modules and services.
        require(__DIR__.'/../../common/config/fecshop_local.php'),

        // appadmin local modules and services.
        require(__DIR__.'/../config/fecshop_local.php')

    );

也就是配置会在初始化的时候合并,通过yii\helpers\ArrayHelper::merge() 函数合并, 高优先级的会覆盖低优先级的,通过配置覆盖的方式来实现功能的重写。

还有什么疑问,在下面留言。

如何store设置多语言?7年前

vagrant 安装的fecshop,有点老,vagrnat的php nginx等环境都弄好了。

建议你搞完后,可以按照安装文件在上面操作一遍,视频已经做好了,可以去百度云盘下载观看。

如何store设置多语言?7年前

对于下面的配置store之一appfront.fecshoptest.com/fr 这个需要在@app/web/下面新建fr文件夹, 默认我记得是有这个文件夹的。如果没有自己新建这个文件夹,可以参看这里的:https://github.com/fecshop/yii2_fecshop_app_advanced/tree/master/appfront/web

'appfront.fecshoptest.com/fr' => [
				'language' 		=> 'fr_FR',
				'languageName' 	=> 'Fran?ais',
				'localThemeDir'	=> '@appfront/theme/terry/theme01',
				'thirdThemeDir'	=> [],
				'currency' 		=> 'RMB',
				'mobile'		=> [
					'enable'			=> true,
					'condition'			=> ['phone'], # phone 代表手机,tablet代表平板。
					'redirectDomain' 	=> 'apphtml5.fecshoptest.com/fr', # 跳转后的url。
				],
			],
			'appfront.fecshoptest.es' => [
				'language' 		=> 'es_ES',
				'languageName' 	=> 'Espa?ol',
				'localThemeDir'	=> '@appfront/theme/terry/theme01',
				'thirdThemeDir'	=> [],
				'currency' 		=> 'USD',
				'mobile'		=> [
					'enable'		=> true,
					'condition'		=> ['tablet'],
					'redirectDomain' 	=> 'fecshop.apphtml5.es.fancyecommerce.com',	
				],
			],

appfront.fecshoptest.es appfront.fecshoptest.com/fr 都是一个store的域名配置。

本地虚拟机安装出错:An internal server error occurred.7年前

你先开启develop模式。打开 /data1/fecshop/appserver/web/index.php

defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

改为:

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

然后看看报错是什么,出现报错自己解决一下试试,如果解决不了,把报错贴在回复里

windows的wamp下不能访问子目录的问题7年前

@liu23 #7楼 赞一个,后面有人报这个错,就把这个链接丢过去。

http://www.jollychic.com/ 功能和UI都值得借鉴7年前

我看了一下你发的网站,他有的功能,fecshop基本都有,有的地方做一些细致的改动即可

模板自己可以模仿二开。

还是多谢推荐,模板的事情自己二开。

后台里面订单打印,物流,自定义付款方式,这些是都需要二次开发的吗?7年前

首先,你搞错了系统的边界

B2C系统,是没有订单打印,物流这些信息,这些是ERP的事情,确切的说是你的库存管理,订单管理,物流管理,采购管理等一系列组合成的erp干的事情。而不是B2C系统。

所以,fecshop不会做这些,是属于另外的系统做的事情。

Your Site Analytics