明白你的问题了,原来你用的mongodb
打开 @fecshop/models/Product.php (@fecshop就是文件路径 ./vendor/fancyecommerce/fecshop)
将函数attributes()
改为:
public function attributes()
{
if (empty($this->_product_attributes)) {
$origin = [
'_id',
'name',
'spu',
'sku',
'score',
'status',
'qty',
'min_sales_qty',
'is_in_stock',
'visibility',
'url_key',
//'url_path',
'category',
'price',
'cost_price',
'special_price',
'special_from',
'special_to',
'tier_price',
'final_price', // 算出来的最终价格。这个通过脚本赋值。
'new_product_from',
'new_product_to',
'freeshipping',
'featured',
'upc',
'meta_title',
'meta_keywords',
'meta_description',
'image',
'sell_7_count',
'sell_30_count',
'sell_90_count',
'description',
'short_description',
'custom_option',
'remark',
'long', // 长
'width', // 宽
'high', // 高
'weight', // 重量
'volume_weight', // 体积重
'package_number', // 打包销售个数,譬如,值为5,则加入购物车的个数都是5的倍数。
'created_at',
'updated_at',
'created_user_id',
'attr_group',
'reviw_rate_star_average', //评论平均评分
'review_count', //评论总数
'reviw_rate_star_average_lang', //(语言)评论平均评分
'review_count_lang', //(语言)评论总数
'reviw_rate_star_info', // 评星详细,各个评星的个数
'reviw_rate_star_info_lang', // (语言)评星详细,各个评星的个数
'favorite_count', // 产品被收藏的次数。
'relation_sku', // 相关产品
'buy_also_buy_sku', // 买了的还买了什么
'see_also_see_sku', // 看了的还看了什么
'origin_mysql_id',
'brand_id',
'remote_id',
'third_refer_url',
'third_refer_code',
'third_product_code',
];
if (is_array(self::$_customProductAttrs) && !empty(self::$_customProductAttrs)) {
$origin = array_merge($origin, self::$_customProductAttrs);
}
$this->_product_attributes = $origin;
}
return $this->_product_attributes;
}
然后试试保存是否可以?