static变量对于类型是全局的,如果我新增了一个新产品,然后添加了对应的产品组,后面我又新增一产品,新品组默认不就是上次的了所选的产品组了吗?我知道后台有选择产品组的功能。而且查询是也会保留次赋值变量$_customProductAttrs的值吗?
纯属交流,并不是说fecshop不好。
/**
* @property $attr_group | String , 属性组名称
* 给product model 增加相应的属性组对应的属性。
*/
protected function actionAddGroupAttrs($attr_group)
{
return $this->_product->addGroupAttrs($attr_group);
}
@PHPJAVAGOC #7楼 windows下composer操作和linux是一样的,参考:http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-about-hand-install.html
我写了5,6年程序,都一直是c/c++。初次接触电商。感谢大神 @Terry 耐心帮助!
我什么也没有修改。
yii\base\InvalidConfigException: Object configuration must be an array containing a "class" element. in D:\wamp\www\wordpress\vendor\yiisoft\yii2\BaseYii.php:353 Stack trace: #0 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Application.php(49): yii\BaseYii::createObject(Array) #1 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Application.php(67): fecshop\services\Application->getChildService('image') #2 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php(69): fecshop\services\Application->get('image') #3 [internal function]: fecshop\services\product\Image->actionGetUrl('/default.jpg') #4 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php(49): call_user_func_array(Array, Array) #5 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php(103): fecshop\services\Service->__call('getUrl', Array) #6 [internal function]: fecshop\services\product\Image->actionDefautImg() #7 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php(49): call_user_func_array(Array, Array) #8 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\category\Product.php(90): fecshop\services\Service->call('defautImg', Array) #9 [internal function]: fecshop\services\category\Product->actionConvertToCategoryInfo(Array) #10 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php(49): call_user_func_array(Array, Array) #11 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php(50): fecshop\services\Service->__call('convertToCatego...', Array) #12 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php(28): fecshop\app\appfront\modules\Cms\block\home\Index->getProductBySkus(Array) #13 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php(19): fecshop\app\appfront\modules\Cms\block\home\Index->getFeaturedProduct() #14 D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\controllers\HomeController.php(19): fecshop\app\appfront\modules\Cms\block\home\Index->getLastData() #15 [internal function]: fecshop\app\appfront\modules\Cms\controllers\HomeController->actionIndex() #16 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array) #17 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array) #18 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('index', Array) #19 D:\wamp\www\wordpress\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('cms/home/index', Array) #20 D:\wamp\www\wordpress\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(fecshop\yii\web\Request)) #21 D:\wamp\www\wordpress\appfront\web\index.php(87): yii\base\Application->run() #22 {main} Copy Stacktrace Search Stackoverflow Search Google Exception Invalid Configuration – yii\base\InvalidConfigException
Object configuration must be an array containing a "class" element.
in D:\wamp\www\wordpress\vendor\yiisoft\yii2\BaseYii.php at line 353 344345346347348349350351352353354355356357358359360361362 if (is_string($type)) {
return static::$container->get($type, $params);
} elseif (is_array($type) && isset($type['class'])) {
$class = $type['class'];
unset($type['class']);
return static::$container->get($class, $params, $type);
} elseif (is_callable($type, true)) {
return static::$container->invoke($type, $params);
} elseif (is_array($type)) {
throw new InvalidConfigException('Object configuration must be an array containing a "class" element.');
}
throw new InvalidConfigException('Unsupported configuration type: ' . gettype($type));
}
private static $_logger;
/**
if (!$this->_childService[$childServiceName]) {
$childService = $this->childService;
if (isset($childService[$childServiceName])) {
$service = $childService[$childServiceName];
if(!isset($service['enableService']) || $service['enableService']){
$this->_childService[$childServiceName] = Yii::createObject($service);
}else{
throw new InvalidConfigException('Child Service ['.$childServiceName.'] is disable in '.get_called_class().', you must config it! ');
}
} else {
throw new InvalidConfigException('Child Service ['.$childServiceName.'] is not find in '.get_called_class().', you must config it! ');
}
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php at line 69 – fecshop\services\Application::__get('image') 63646566676869707172737475 /**
/**
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php at line 49 – call_user_func_array([fecshop\services\product\Image, 'actionGetUrl'], ['/default.jpg']) 43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\product\Image.php at line 103 – fecshop\services\Service::__call('getUrl', ['/default.jpg']) 979899100101102103104105106107108109 /**
获取产品默认图片的完整URL */ protected function actionDefautImg() { if (!$this->_defaultImg) {
$this->_defaultImg = $this->getUrl($this->defaultImg);
}
return $this->_defaultImg; }
/**
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php at line 49 – call_user_func_array([fecshop\services\product\Image, 'actionDefautImg'], []) 43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
foreach ($collection as $one) {
if (is_array($one['name']) && !empty($one['name'])) {
$name = Yii::$service->store->getStoreAttrVal($one['name'], 'name');
} else {
$name = $one['name'];
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\services\Service.php at line 49 – call_user_func_array([fecshop\services\category\Product, 'actionConvertToCategoryInfo'], [[]]) 43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php at line 50 – fecshop\services\Service::__call('convertToCategoryInfo', [[]]) 44454647484950515253545556 'special_from', 'special_to',
'url_key', 'score',
];
$filter['where'] = ['in', 'sku', $skus];
$products = Yii::$service->product->getProducts($filter);
//var_dump($products);
$products = Yii::$service->category->product->convertToCategoryInfo($products);
return $products;
}
}
public function initHead()
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php at line 28 – fecshop\app\appfront\modules\Cms\block\home\Index::getProductBySkus(['men0003', 'men0002', 'men0001', 'computer001-xinghao2-cpu3', ...]) 22232425262728293031323334 }
public function getFeaturedProduct() {
$featured_skus = Yii::$app->controller->module->params['homeFeaturedSku'];
return $this->getProductBySkus($featured_skus);
}
public function getBestSellerProducts() {
$bestSellSkus = Yii::$app->controller->module->params['homeBestSellerSku'];
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\block\home\Index.php at line 19 – fecshop\app\appfront\modules\Cms\block\home\Index::getFeaturedProduct() 13141516171819202122232425 public function getLastData() {
$this->initHead();
// change current layout File.
//Yii::$service->page->theme->layoutFile = 'home.php';
return [
'bestFeaturedProducts' => $this->getFeaturedProduct(),
'bestSellerProducts' => $this->getBestSellerProducts(),
];
}
public function getFeaturedProduct() {
in D:\wamp\www\wordpress\vendor\fancyecommerce\fecshop\app\appfront\modules\Cms\controllers\HomeController.php at line 19 – fecshop\app\appfront\modules\Cms\block\home\Index::getLastData() 13141516171819202122232425 parent::init(); }
// 网站信息管理 public function actionIndex() {
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id, $data);
}
public function behaviors() {
$application = new yii\web\Application($config); $application->run(); $_COOKIE = [
'PHPSESSID' => 'gc8r46grouj2gud4em5m0v7dd0',
];
$_SESSION = [
'__flash' => [],
'currency_current' => 'USD',
]; Yii Framework 2017-11-17, 06:36:48
Apache/2.4.23 (Win32) PHP/7.0.10 Yii Framework/2.0.13