Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
毕凯
9 years ago
Commit
1f47ab7a01fd595021b8f1949a9dfc44ce9ee4c5
2 parents
4a41352a
d6c8910f
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
1f47ab7
...
...
@@ -153,8 +153,9 @@ class DetailModel
// 商品信息
if
(
!
empty
(
$baseInfo
[
'goodsList'
]))
{
$colorGroup
=
array
();
$size
List
=
array
();
$size
Group
=
array
();
$goodsGroup
=
array
();
$sizeList
=
array
();
$thumbImageList
=
array
();
$colorStorageGroup
=
array
();
// 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr
=
''
;
// 尺码库存总数集合, 多个之间用/分隔
...
...
@@ -177,7 +178,7 @@ class DetailModel
// 商品的尺码列表
if
(
isset
(
$value
[
'goodsSizeBoList'
]))
{
foreach
(
$value
[
'goodsSizeBoList'
]
as
$size
)
{
$sizeList
[]
=
array
(
$sizeList
[
$value
[
'colorId'
]
][
]
=
array
(
'id'
=>
$size
[
'id'
],
'skuId'
=>
$size
[
'goodsSizeSkuId'
],
'goodsId'
=>
$size
[
'goodsId'
],
...
...
@@ -189,22 +190,21 @@ class DetailModel
$sizeStorageStr
.=
$size
[
'goodsSizeStorageNum'
]
.
'/'
;
$colorStorageGroup
[
$size
[
'sizeName'
]
][
$value
[
'colorName'
]
]
=
$size
[
'goodsSizeStorageNum'
];
}
// 颜色分组
$colorGroup
[]
=
array
(
'id'
=>
$value
[
'colorId'
],
'skcId'
=>
$value
[
'productSkc'
],
'name'
=>
$value
[
'colorName'
],
'goodsName'
=>
$value
[
'goodsName'
],
'colorNum'
=>
$colorStorageNum
,
'sizeNumStr'
=>
rtrim
(
$sizeStorageStr
,
'/'
),
);
}
// 颜色分组
$colorGroup
[]
=
array
(
'id'
=>
$value
[
'colorId'
],
'skcId'
=>
$value
[
'productSkc'
],
'name'
=>
$value
[
'colorName'
],
'goodsName'
=>
$value
[
'goodsName'
],
'colorNum'
=>
$colorStorageNum
,
'sizeNumStr'
=>
rtrim
(
$sizeStorageStr
,
'/'
),
);
// 缩略图
$thumbImageList
[]
=
array
(
'img'
=>
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
)
);
// 统计尺码对应的各个颜色的库存量
foreach
(
$sizeList
as
&
$sizeArr
)
{
$sizeArr
[
'colorNumStr'
]
=
implode
(
'/'
,
array_values
(
$colorStorageGroup
[
$sizeArr
[
'name'
]
])
);
}
...
...
@@ -212,6 +212,11 @@ class DetailModel
// 商品库存总数
$totalStorageNum
+=
$colorStorageNum
;
}
// 统计尺码对应的各个颜色的库存量
foreach
(
$colorGroup
as
$value
)
{
$sizeGroup
[][
'size'
]
=
$sizeList
[
$value
[
'colorId'
]
];
}
// 商品图: 多个
if
(
isset
(
$goodsGroup
[
1
]))
{
...
...
@@ -247,7 +252,7 @@ class DetailModel
$result
[
'cartInfo'
][
'salePrice'
]
=
isset
(
$result
[
'goodsPrice'
][
'currentPrice'
])
?
$result
[
'goodsPrice'
][
'currentPrice'
]
:
''
;
$result
[
'cartInfo'
][
'totalNum'
]
=
$totalStorageNum
;
$result
[
'cartInfo'
][
'colors'
]
=
$colorGroup
;
$result
[
'cartInfo'
][
'sizes'
]
=
$size
List
;
$result
[
'cartInfo'
][
'sizes'
]
=
$size
Group
;
}
// 非卖品
elseif
(
$notForSale
)
{
...
...
Please
register
or
login
to post a comment