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
周少峰
9 years ago
Commit
1908792a3924187795c6189e801a599c7dbde2fb
1 parent
28baa1fe
下架商品过滤,商品右侧小图一个时不显示
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
33 deletions
library/WebPlugin/HelperSearch.php
yohobuy/www.yohobuy.com/application/modules/Product/controllers/List.php
library/WebPlugin/HelperSearch.php
View file @
1908792
...
...
@@ -165,52 +165,40 @@ class HelperSearch
return
$goods
;
}
foreach
(
$product
as
$key
=>
$val
){
//NEW
$isNew
=
$val
[
'is_new'
]
==
'Y'
?
true
:
false
;
//限量商品
$isLimit
=
isset
(
$val
[
'is_limited'
])
&&
$val
[
'is_limited'
]
===
'Y'
;
//即将售罄
$isFew
=
$val
[
'is_soon_sold_out'
]
===
'Y'
?
true
:
false
;
//SALE
$isSale
=
(
$val
[
'is_discount'
]
==
'Y'
)
?
true
:
false
;
//新品节
//再到着
//年终大促
// 年中大促
if
(
$options
[
'controller'
]
==
'List'
&&
$options
[
'action'
]
==
'new'
)
{
$isNew
=
false
;
$isSale
=
false
;
//TODO再到着不显示
}
if
(
$options
[
'controller'
]
==
'List'
&&
$options
[
'action'
]
==
'sale'
)
{
$isNew
=
false
;
$isSale
=
false
;
}
//SALE、NEW标签不共存
if
(
$isNew
)
{
$isSale
=
false
;
if
(
!
isset
(
$val
[
'goods_list'
])
||
empty
(
$val
[
'goods_list'
]))
{
continue
;
}
$gender
=
0
;
if
(
isset
(
self
::
$params
[
'gender'
]))
{
$genderArr
=
explode
(
','
,
self
::
$params
[
'gender'
]);
$gender
=
$genderArr
[
0
];
}
//默认商品链接
$defaultGood
=
''
;
foreach
(
$val
[
'goods_list'
]
as
$k
=>
$v
){
$goods_list
[
$k
][
'url'
]
=
Helpers
::
getUrlBySkc
(
$val
[
'product_id'
],
$v
[
'goods_id'
],
$val
[
'cn_alphabet'
]);
//删除下架的商品
if
(
$v
[
'status'
]
==
0
)
{
continue
;
}
//男封
if
(
isset
(
$v
[
'cover_1'
])
&&
!
empty
(
$v
[
'cover_1'
])
&&
$gender
==
1
)
{
$val
[
'default_images'
]
=
$v
[
'cover_1'
];
$defaultGood
=
$v
[
'goods_id'
];
}
//女封
if
(
isset
(
$v
[
'cover_2'
])
&&
!
empty
(
$v
[
'cover_2'
])
&&
$gender
==
2
)
{
else
if
(
isset
(
$v
[
'cover_2'
])
&&
!
empty
(
$v
[
'cover_2'
])
&&
$gender
==
2
)
{
$val
[
'default_images'
]
=
$v
[
'cover_2'
];
$defaultGood
=
$v
[
'goods_id'
];
}
//筛选符合颜色条件的封面图片
if
(
isset
(
$params
[
'color'
])
&&
$params
[
'color'
]
==
$v
[
'color_id'
])
{
$val
[
'default_images'
]
=
$v
[
'images_url'
];
$defaultGood
=
$v
[
'goods_id'
];
break
;
}
$defaultGood
=
$defaultGood
?
$defaultGood
:
$v
[
'goods_id'
];
}
$defaultUrl
=
Helpers
::
getUrlBySkc
(
$val
[
'product_id'
],
$defaultGood
,
$val
[
'cn_alphabet'
]);
if
(
!
empty
(
$val
[
'default_images'
]))
{
$val
[
'default_images'
]
=
Images
::
getImageUrl
(
$val
[
'default_images'
],
$options
[
'imgSize'
][
0
],
$options
[
'imgSize'
][
1
]);
}
...
...
@@ -222,13 +210,38 @@ class HelperSearch
}
$val
[
'product_name'
]
=
preg_replace
(
$match
,
$replace
,
$val
[
'product_name'
]);
}
//NEW
$isNew
=
$val
[
'is_new'
]
==
'Y'
?
true
:
false
;
//限量商品
$isLimit
=
isset
(
$val
[
'is_limited'
])
&&
$val
[
'is_limited'
]
===
'Y'
;
//即将售罄
$isFew
=
$val
[
'is_soon_sold_out'
]
===
'Y'
?
true
:
false
;
//SALE
$isSale
=
(
$val
[
'is_discount'
]
==
'Y'
)
?
true
:
false
;
//新品节
//再到着
//年终大促
// 年中大促
if
(
$options
[
'controller'
]
==
'List'
&&
$options
[
'action'
]
==
'new'
)
{
$isNew
=
false
;
$isSale
=
false
;
//TODO再到着不显示
}
if
(
$options
[
'controller'
]
==
'List'
&&
$options
[
'action'
]
==
'sale'
)
{
$isNew
=
false
;
$isSale
=
false
;
}
//SALE、NEW标签不共存
if
(
$isNew
)
{
$isSale
=
false
;
}
$good
=
array
(
'tags'
=>
array
(
'isNew'
=>
$isNew
,
'isLimit'
=>
$isLimit
,
'isSale'
=>
$isSale
),
'url'
=>
self
::
fromPram
(
$
goods_list
[
0
][
'url'
]
,
++
$key
),
'url'
=>
self
::
fromPram
(
$
defaultUrl
,
++
$key
),
'thumb'
=>
$val
[
'default_images'
],
'name'
=>
$val
[
'product_name'
],
'salePrice'
=>
$val
[
'sales_price'
],
...
...
@@ -1195,12 +1208,15 @@ class HelperSearch
$result
= array();
if (isset(
$product[0]['goods_list']
) && !empty(
$product[0]['goods_list']
)){
foreach (
$product[0]['goods_list']
as
$key
=>
$val
){
$result[$key]['coverImg']
= Images::getImageUrl(
$val['images_url']
,
$options['imgSize'][0]
,
$options['imgSize'][1]
);
if (
$val['status']
== 0) {
continue;
}
$result[$key]['coverImg']
= Images::getImageUrl(
$val['images_url']
,
$options['minImgSize'][0]
,
$options['minImgSize'][1]
);
$result[$key]['url']
= Helpers::getUrlBySkc(
$product[0]['product_id']
,
$val['goods_id']
,
$product[0]['cn_alphabet']
);
$result[$key]['src']
= Images::getImageUrl(
$val['images_url']
,
$options['imgSize'][0]
,
$options['imgSize'][1]
);
}
}
return
$result
;
return
array_values(
$result
)
;
}
/**
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/List.php
View file @
1908792
...
...
@@ -108,10 +108,6 @@ class ListController extends WebAction
$this
->
echoJson
(
$res
);
return
;
}
//大图
$imgSize
=
array
();
//小图
$minImgSize
=
array
();
$rowNum
=
$this
->
post
(
'rowNum'
);
if
(
$rowNum
==
5
)
{
$imgSize
=
array
(
195
,
260
);
...
...
Please
register
or
login
to post a comment