Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
193f9f9c
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
18
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yii2_fecshop
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
193f9f9c
编写于
8月 28, 2017
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
appserver product custom option
上级
ba52526e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
7 deletion
+35
-7
app/appserver/modules/Catalog/controllers/ProductController.php
...pserver/modules/Catalog/controllers/ProductController.php
+31
-4
services/category/Product.php
services/category/Product.php
+0
-2
services/product/ProductMongodb.php
services/product/ProductMongodb.php
+4
-1
未找到文件。
app/appserver/modules/Catalog/controllers/ProductController.php
浏览文件 @
193f9f9c
...
...
@@ -62,7 +62,10 @@ class ProductController extends AppserverController
$this
->
filterProductImg
(
$this
->
_product
[
'image'
]);
$groupAttr
=
Yii
::
$service
->
product
->
getGroupAttr
(
$this
->
_product
[
'attr_group'
]);
$groupAttrArr
=
$this
->
getGroupAttrArr
(
$groupAttr
);
$custom_option_attr_info
=
Yii
::
$service
->
product
->
getCustomOptionAttrInfo
(
$this
->
_product
[
'attr_group'
]);
//var_dump($custom_option_attr_info);exit;
$custom_option_showImg_attr
=
$this
->
getCustomOptionShowImgAttr
(
$custom_option_attr_info
);
//var_dump($custom_option_showImg_attr );exit;
$thumbnail_img
=
[];
$image
=
$this
->
_image_thumbnails
;
if
(
isset
(
$image
[
'gallery'
])
&&
is_array
(
$image
[
'gallery'
])
&&
!
empty
(
$image
[
'gallery'
])){
...
...
@@ -83,7 +86,7 @@ class ProductController extends AppserverController
$thumbnail_img
[]
=
Yii
::
$service
->
product
->
image
->
getResize
(
$image
,
$middle_img_width
,
false
);
}
}
$custom_option
=
$this
->
getCustomOption
(
$this
->
_product
[
'custom_option'
],
$middle_img_width
);
return
[
'code'
=>
200
,
'content'
=>
[
...
...
@@ -92,7 +95,8 @@ class ProductController extends AppserverController
'sku'
=>
$this
->
_product
[
'sku'
],
'spu'
=>
$this
->
_product
[
'spu'
],
'thumbnail_img'
=>
$thumbnail_img
,
'groupAttrArr'
=>
$groupAttrArr
,
'custom_option_showImg_attr'
=>
$custom_option_showImg_attr
,
//'groupAttrArr' => $groupAttrArr,
//'image_thumbnails' => $this->_image_thumbnails,
'image_detail'
=>
$this
->
_image_detail
,
'attr_group'
=>
$this
->
_product
[
'attr_group'
],
...
...
@@ -107,7 +111,7 @@ class ProductController extends AppserverController
//],
//'productImgMagnifier' => $productImgMagnifier,
'options'
=>
$this
->
getSameSpuInfo
(),
'custom_option'
=>
$
this
->
_product
[
'custom_option'
]
,
'custom_option'
=>
$
custom_option
,
'description'
=>
Yii
::
$service
->
store
->
getStoreAttrVal
(
$this
->
_product
[
'description'
],
'description'
),
'_id'
=>
$this
->
_product
[
'_id'
],
'buy_also_buy'
=>
$this
->
getProductBySkus
(
$skus
),
...
...
@@ -115,6 +119,29 @@ class ProductController extends AppserverController
]
];
}
public
function
getCustomOptionShowImgAttr
(
$custom_option_attr_info
){
foreach
(
$custom_option_attr_info
as
$attr
=>
$one
){
if
(
$one
[
'showAsImg'
]){
return
$attr
;
}
}
}
public
function
getCustomOption
(
$custom_option
,
$middle_img_width
){
$arr
=
[];
if
(
is_array
(
$custom_option
)){
foreach
(
$custom_option
as
$attr
=>
$one
){
if
(
$attr
&&
isset
(
$one
[
'image'
])
&&
$one
[
'image'
]){
$one
[
'image'
]
=
Yii
::
$service
->
product
->
image
->
getResize
(
$one
[
'image'
],[
40
,
45
],
false
);
$arr
[
$attr
]
=
$one
;
}
}
}
return
$arr
;
}
public
function
getGroupAttrArr
(
$groupAttr
){
$gArr
=
[];
if
(
is_array
(
$groupAttr
)){
...
...
services/category/Product.php
浏览文件 @
193f9f9c
...
...
@@ -74,9 +74,7 @@ class Product extends Service
$coll
=
Yii
::
$service
->
product
->
getFrontCategoryProducts
(
$filter
);
$collection
=
$coll
[
'coll'
];
$count
=
$coll
[
'count'
];
$arr
=
$this
->
convertToCategoryInfo
(
$collection
);
return
[
'coll'
=>
$arr
,
'count'
=>
$count
,
...
...
services/product/ProductMongodb.php
浏览文件 @
193f9f9c
...
...
@@ -553,9 +553,12 @@ class ProductMongodb implements ProductInterface
}
$group
[
'product_id'
]
=
[
'$first'
=>
'$product_id'
];
$langCode
=
Yii
::
$service
->
store
->
currentLangCode
;
$name_lang
=
Yii
::
$service
->
fecshoplang
->
getLangAttrName
(
'name'
,
$langCode
);
$default_name_lang
=
Yii
::
$service
->
fecshoplang
->
GetDefaultLangAttrName
(
'name'
);
$project
[
'name'
]
=
[
$name_lang
=>
1
$default_name_lang
=>
1
,
$name_lang
=>
1
,
];
$project
[
'product_id'
]
=
'$_id'
;
$pipelines
=
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录