Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
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
hf
9 years ago
Commit
3445d7df32cea76203a6223338cf9d2576812cc8
2 parents
157fe40d
4b6a0880
Merge remote-tracking branch 'origin/develop' into test
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
58 deletions
library/LibModels/Wap/Product/SearchData.php
library/Plugin/Helpers.php
library/Plugin/Images.php
static/js/product/list.js
template/m.yohobuy.com/actions/product/index/index.phtml
library/LibModels/Wap/Product/SearchData.php
View file @
3445d7d
...
...
@@ -23,7 +23,7 @@ class SearchData
* 模糊搜索提供的关键词
*
* @param string $keyword 关键词
* @return array 根据
跟
定关键词搜索到的结果,包括数据数目count和提供的关键词keyword
* @return array 根据
给
定关键词搜索到的结果,包括数据数目count和提供的关键词keyword
*/
public
static
function
searchFuzzyDatas
(
$keyword
)
{
...
...
@@ -38,7 +38,7 @@ class SearchData
}
/**
* 根据
跟
定查询数据搜索数据列表
* 根据
给
定查询数据搜索数据列表
*
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
...
...
@@ -97,9 +97,9 @@ class SearchData
return
Yohobuy
::
get
(
self
::
$_searchurl
,
$param
);
}
/**
* 根据
跟
定查询数据搜索数据列表
* 根据
给
定查询数据搜索数据列表
*
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
...
...
library/Plugin/Helpers.php
View file @
3445d7d
...
...
@@ -123,10 +123,9 @@ class Helpers
* @param bool $showTag 控制是否显示标签
* @param bool $showNew 控制是否显示NEW图标
* @param bool $showSale 控制是否显示SALE图标
* @param bool $fromSearch 是否是搜索页搜出来的商品数据
* @return array | false
*/
public
static
function
formatProduct
(
$productData
,
$showTags
=
true
,
$showNew
=
true
,
$showSale
=
true
,
$fromSearch
=
false
)
public
static
function
formatProduct
(
$productData
,
$showTags
=
true
,
$showNew
=
true
,
$showSale
=
true
)
{
// 商品信息有问题,则不显示
...
...
@@ -139,7 +138,7 @@ class Helpers
$productData
[
'market_price'
]
=
false
;
}
// 如果$productData['default_images']为
null
,就取$productData['goods_list']中第一个,为空就不处理
// 如果$productData['default_images']为
空
,就取$productData['goods_list']中第一个,为空就不处理
if
(
empty
(
$productData
[
'default_images'
]))
{
$productData
[
'default_images'
]
=
$productData
[
'goods_list'
][
0
];
}
...
...
@@ -148,12 +147,7 @@ class Helpers
$result
[
'id'
]
=
$productData
[
'product_skn'
];
$result
[
'product_id'
]
=
$productData
[
'product_id'
];
// // 如果是来自搜索页搜索出来的图片要先处理一下
// if ($fromSearch && $productData['default_images']) {
// $productData['default_images'] = Images::template($productData['default_images'], 'goodsimg');
// }
$result
[
'thumb'
]
=
self
::
getImageUrl
(
$productData
[
'default_images'
],
235
,
314
);
$result
[
'thumb'
]
=
Images
::
getImageUrl
(
$productData
[
'default_images'
],
235
,
314
);
$result
[
'name'
]
=
$productData
[
'product_name'
];
$result
[
'price'
]
=
$productData
[
'market_price'
];
$result
[
'salePrice'
]
=
$productData
[
'sales_price'
];
...
...
library/Plugin/Images.php
View file @
3445d7d
...
...
@@ -37,7 +37,6 @@ class Images
*/
static
function
template
(
$fileName
,
$bucket
=
'yhfair'
,
$mode
=
1
)
{
return
self
::
url
(
$fileName
,
$bucket
,
$mode
);
}
...
...
@@ -65,26 +64,12 @@ class Images
* @param string $bucket
* @return mixed
*/
public
static
function
getImageUrl
(
$fileName
,
$width
,
$height
,
$mode
=
1
,
$bucket
=
'yhfair'
){
public
static
function
getImageUrl
(
$fileName
,
$width
,
$height
,
$mode
=
1
,
$bucket
=
'goodsimg'
)
{
if
(
!
preg_match
(
'|http://|'
,
$fileName
)){
$fileName
=
self
::
template
(
$fileName
,
$bucket
,
$mode
);
}
return
str_replace
(
'{width}'
,
$width
,
str_replace
(
'{height}'
,
$height
,
str_replace
(
'{mode}'
,
$mode
,
$fileName
)));
}
/**
* 缩略图模板
* @param $fileName
* @param $bucket
* @param string $position ()
* @param string $background
* @return string
*/
static
function
template2
(
$fileName
,
$bucket
,
$position
=
'center'
,
$background
=
'd2hpdGU='
)
{
$domain
=
self
::
getDomain
(
$bucket
,
$fileName
);
$key
=
$bucket
.
$fileName
;
return
self
::
MakeBaseUrl
(
$domain
,
$key
)
.
'?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/'
.
$background
.
'/position/'
.
$position
.
'/quality/90'
;
return
strtr
(
$fileName
,
array
(
'{width}'
=>
$width
,
'{height}'
=>
$height
,
'{mode}'
=>
$mode
));
}
/**
...
...
@@ -140,34 +125,17 @@ class Images
return
"http://
$domain
/
$keyEsc
"
;
}
private
static
function
MakeTemplateRequest
(
$url
)
{
private
static
function
MakeTemplateRequest
(
$url
)
{
$ops
=
array
();
$ops
[]
=
'{mode}'
;
$ops
[]
=
'w/{width}'
;
$ops
[]
=
'h/{height}'
;
if
(
empty
(
$ops
))
{
return
$url
;
}
return
$url
.
"?imageView/"
.
implode
(
'/'
,
$ops
);
}
$ops
[]
=
'{mode}'
;
$ops
[]
=
'w/{width}'
;
$ops
[]
=
'h/{height}'
;
/**
* 获取老的图片地址
* @param $fileName
* @param $bucket
* @param $width
* @param $height
* @param string $position
* @param string $background
* @return mixed
*/
public
static
function
getUrl
(
$fileName
,
$width
,
$height
,
$bucket
,
$position
=
'center'
,
$background
=
'd2hpdGU='
)
{
if
(
empty
(
$fileName
)){
$fileName
=
self
::
$default_image
;
if
(
empty
(
$ops
))
{
return
$url
;
}
$url
=
self
::
template2
(
$fileName
,
$bucket
,
$position
,
$background
);
return
str_replace
(
array
(
'{width}'
,
'{height}'
),
array
(
$width
,
$height
),
$url
);
return
$url
.
"?imageView/"
.
implode
(
'/'
,
$ops
);
}
}
\ No newline at end of file
...
...
static/js/product/list.js
View file @
3445d7d
...
...
@@ -30,7 +30,8 @@ var defaultOpt = {
color
:
$
(
'#color'
).
val
(),
size
:
$
(
'#size'
).
val
(),
price
:
$
(
'#price'
).
val
(),
discount
:
$
(
'#discount'
).
val
()
discount
:
$
(
'#discount'
).
val
(),
query
:
$
(
'#query'
).
val
()
};
var
$listNav
=
$
(
'#list-nav'
),
...
...
template/m.yohobuy.com/actions/product/index/index.phtml
View file @
3445d7d
...
...
@@ -122,6 +122,10 @@
{
{#if
discount
}
}
<input
id=
"discount"
type=
"hidden"
value=
{
{discount
}
}>
{
{/if
}
}
{
{#if
query
}
}
<input
id=
"query"
type=
"hidden"
value=
{
{query
}
}>
{
{/if
}
}
{
{/
goodList
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment