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
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
afa1ac4de5cf480109283945d148d4f70b7b3f68
1 parent
048c41f0
code review by hf: do modify cart list add cartType parameter
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
53 deletions
library/Plugin/Helpers.php
library/Plugin/Helpers.php
View file @
afa1ac4
...
...
@@ -567,41 +567,41 @@ class Helpers
{
$arr
=
array
();
$oneGoods
=
array
();
foreach
(
$cartGoods
as
$key
=>
$value
)
{
$oneGoods
[
'id'
]
=
$value
[
'product_sku'
];
$oneGoods
[
'skn'
]
=
$value
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$value
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$value
[
'goods_images'
])
?
Images
::
getImageUrl
(
$value
[
'goods_images'
],
90
,
100
)
:
''
;
$oneGoods
[
'color'
]
=
$value
[
'color_name'
];
$oneGoods
[
'size'
]
=
$value
[
'size_name'
];
$oneGoods
=
array
();
foreach
(
$cartGoods
as
$key
=>
$value
)
{
$oneGoods
[
'id'
]
=
$value
[
'product_sku'
];
$oneGoods
[
'skn'
]
=
$value
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$value
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$value
[
'goods_images'
])
?
Images
::
getImageUrl
(
$value
[
'goods_images'
],
90
,
100
)
:
''
;
$oneGoods
[
'color'
]
=
$value
[
'color_name'
];
$oneGoods
[
'size'
]
=
$value
[
'size_name'
];
$oneGoods
[
'isSelected'
]
=
$value
[
'selected'
]
===
'Y'
;
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$value
[
'sales_price'
]);
$oneGoods
[
'count'
]
=
$value
[
'buy_number'
];
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$value
[
'sales_price'
]);
$oneGoods
[
'count'
]
=
$value
[
'buy_number'
];
if
(
$isValid
)
{
$oneGoods
[
'lowStocks'
]
=
(
$value
[
'buy_number'
]
>
$value
[
'storage_number'
]);
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if
(
!
isset
(
$value
[
'goods_type'
]))
{
$oneGoods
[
'isSoldOut'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'gift'
&&
!
isset
(
$value
[
'isAdvanceBuy'
]))
{
$oneGoods
[
'isGift'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'price_gift'
)
{
$oneGoods
[
'isAdvanceBuy'
]
=
true
;
}
// 上市期
if
(
!
empty
(
$value
[
'expect_arrival_time'
]))
{
$oneGoods
[
'appearDate'
]
=
$value
[
'expect_arrival_time'
];
}
// 商品链接
if
(
isset
(
$value
[
'cn_alphabet'
])
)
{
$oneGoods
[
'url'
]
=
self
::
url
(
'/product/pro_'
.
$value
[
'product_id'
]
.
'_'
.
$value
[
'goods_id'
]
.
'/'
.
$value
[
'cn_alphabet'
]
.
'.html'
);
}
$arr
[
$key
]
=
$oneGoods
;
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if
(
!
isset
(
$value
[
'goods_type'
]))
{
$oneGoods
[
'isSoldOut'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'gift'
&&
!
isset
(
$value
[
'isAdvanceBuy'
]))
{
$oneGoods
[
'isGift'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'price_gift'
)
{
$oneGoods
[
'isAdvanceBuy'
]
=
true
;
}
// 上市期
if
(
!
empty
(
$value
[
'expect_arrival_time'
]))
{
$oneGoods
[
'appearDate'
]
=
$value
[
'expect_arrival_time'
];
}
// 商品链接
if
(
isset
(
$value
[
'cn_alphabet'
]))
{
$oneGoods
[
'url'
]
=
self
::
url
(
'/product/pro_'
.
$value
[
'product_id'
]
.
'_'
.
$value
[
'goods_id'
]
.
'/'
.
$value
[
'cn_alphabet'
]
.
'.html'
);
}
$arr
[
$key
]
=
$oneGoods
;
}
return
$arr
;
}
...
...
@@ -617,30 +617,30 @@ class Helpers
{
$arr
=
array
();
$gift
=
array
();
$oneGoods
=
array
();
foreach
(
$advanceGoods
as
$value
)
{
$gift
=
array
();
$gift
[
'promotionId'
]
=
$value
[
'promotion_id'
];
$gift
[
'promotionTitle'
]
=
$value
[
'promotion_title'
];
foreach
(
$value
[
'goods_list'
]
as
$single
)
{
$oneGoods
[
'id'
]
=
$single
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$single
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$single
[
'goods_images'
])
?
Images
::
getImageUrl
(
$single
[
'goods_images'
],
120
,
160
)
:
''
;
$oneGoods
[
'appearDate'
]
=
'12月'
;
// 目前app接口没有返回该数据
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$single
[
'last_price'
]);
$oneGoods
[
'marketPrice'
]
=
self
::
transPrice
(
$single
[
'market_price'
]);
$oneGoods
[
'count'
]
=
$single
[
'storage_number'
];
$gift
[
'goods'
][]
=
$oneGoods
;
}
$arr
[]
=
$gift
;
// 计算加价购商品数目
$count
+=
$value
[
'max_select_number'
];
}
$gift
=
array
();
$oneGoods
=
array
();
foreach
(
$advanceGoods
as
$value
)
{
$gift
=
array
();
$gift
[
'promotionId'
]
=
$value
[
'promotion_id'
];
$gift
[
'promotionTitle'
]
=
$value
[
'promotion_title'
];
foreach
(
$value
[
'goods_list'
]
as
$single
)
{
$oneGoods
[
'id'
]
=
$single
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$single
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$single
[
'goods_images'
])
?
Images
::
getImageUrl
(
$single
[
'goods_images'
],
120
,
160
)
:
''
;
$oneGoods
[
'appearDate'
]
=
'12月'
;
// 目前app接口没有返回该数据
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$single
[
'last_price'
]);
$oneGoods
[
'marketPrice'
]
=
self
::
transPrice
(
$single
[
'market_price'
]);
$oneGoods
[
'count'
]
=
$single
[
'storage_number'
];
$gift
[
'goods'
][]
=
$oneGoods
;
}
$arr
[]
=
$gift
;
// 计算加价购商品数目
$count
+=
$value
[
'max_select_number'
];
}
return
$arr
;
}
...
...
Please
register
or
login
to post a comment