Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
6096b9a9
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,发现更多精彩内容 >>
提交
6096b9a9
编写于
11月 24, 2016
作者:
R
root
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加产品详情页功能:买了这个产品的人还买了什么产品
上级
7ff68629
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
185 addition
and
2 deletion
+185
-2
app/appadmin/modules/Catalog/block/productinfo/Manageredit.php
...ppadmin/modules/Catalog/block/productinfo/Manageredit.php
+8
-0
app/appadmin/modules/Catalog/block/productinfo/index/Attr.php
...appadmin/modules/Catalog/block/productinfo/index/Attr.php
+38
-0
app/appadmin/modules/Catalog/views/productinfo/manageredit.php
...ppadmin/modules/Catalog/views/productinfo/manageredit.php
+9
-0
app/appfront/modules/Catalog/block/product/Index.php
app/appfront/modules/Catalog/block/product/Index.php
+24
-1
app/appfront/theme/base/front/assets/css/style.css
app/appfront/theme/base/front/assets/css/style.css
+25
-0
app/appfront/theme/base/front/catalog/product/index.php
app/appfront/theme/base/front/catalog/product/index.php
+21
-1
app/appfront/theme/base/front/catalog/product/index/buy_also_buy.php
...t/theme/base/front/catalog/product/index/buy_also_buy.php
+57
-0
models/mongodb/Product.php
models/mongodb/Product.php
+3
-0
未找到文件。
app/appadmin/modules/Catalog/block/productinfo/Manageredit.php
浏览文件 @
6096b9a9
...
@@ -67,6 +67,7 @@ class Manageredit extends AppadminbaseBlockEdit implements AppadminbaseBlockEdi
...
@@ -67,6 +67,7 @@ class Manageredit extends AppadminbaseBlockEdit implements AppadminbaseBlockEdi
'custom_option_add'
=>
$this
->
getCustomOptionAdd
(),
'custom_option_add'
=>
$this
->
getCustomOptionAdd
(),
'custom_option_img'
=>
$this
->
getCustomOpImgHtml
(),
'custom_option_img'
=>
$this
->
getCustomOpImgHtml
(),
'custom_option_list'
=>
$this
->
_custom_option_list_str
,
'custom_option_list'
=>
$this
->
_custom_option_list_str
,
'relation'
=>
$this
->
getRelationInfo
(),
];
];
}
}
...
@@ -139,6 +140,13 @@ class Manageredit extends AppadminbaseBlockEdit implements AppadminbaseBlockEdi
...
@@ -139,6 +140,13 @@ class Manageredit extends AppadminbaseBlockEdit implements AppadminbaseBlockEdi
}
}
public
function
getRelationInfo
(){
$this
->
_lang_attr
=
''
;
$this
->
_textareas
=
''
;
$editArr
=
$this
->
_attr
->
getRelationInfo
();
$editBar
=
$this
->
getEditBar
(
$editArr
);
return
$this
->
_lang_attr
.
$editBar
.
$this
->
_textareas
;
}
public
function
getBaseInfo
(){
public
function
getBaseInfo
(){
$this
->
_lang_attr
=
''
;
$this
->
_lang_attr
=
''
;
...
...
app/appadmin/modules/Catalog/block/productinfo/index/Attr.php
浏览文件 @
6096b9a9
...
@@ -65,6 +65,44 @@ class Attr
...
@@ -65,6 +65,44 @@ class Attr
}
}
public
function
getRelationInfo
(){
return
[
[
'label'
=>
'相关产品sku(逗号隔开)'
,
'name'
=>
'relation_sku'
,
'display'
=>
[
'type'
=>
'inputString'
,
],
'require'
=>
0
,
],
[
'label'
=>
'买了还买sku(逗号隔开)'
,
'name'
=>
'buy_also_buy_sku'
,
'display'
=>
[
'type'
=>
'inputString'
,
],
'require'
=>
0
,
],
[
'label'
=>
'看了还看sku(逗号隔开)'
,
'name'
=>
'see_also_see_sku'
,
'display'
=>
[
'type'
=>
'inputString'
,
],
'require'
=>
0
,
],
];
}
public
function
getBaseInfo
(){
public
function
getBaseInfo
(){
return
[
return
[
[
[
...
...
app/appadmin/modules/Catalog/views/productinfo/manageredit.php
浏览文件 @
6096b9a9
...
@@ -208,6 +208,7 @@ function thissubmit(thiss){
...
@@ -208,6 +208,7 @@ function thissubmit(thiss){
<li><a
href=
"javascript:;"
><span>
分类信息
</span></a></li>
<li><a
href=
"javascript:;"
><span>
分类信息
</span></a></li>
<li><a
href=
"javascript:;"
><span>
属性组信息
</span></a></li>
<li><a
href=
"javascript:;"
><span>
属性组信息
</span></a></li>
<li><a
href=
"javascript:;"
><span>
自定义信息
</span></a></li>
<li><a
href=
"javascript:;"
><span>
自定义信息
</span></a></li>
<li><a
href=
"javascript:;"
><span>
相关产品信息
</span></a></li>
</ul>
</ul>
</div>
</div>
</div>
</div>
...
@@ -479,6 +480,14 @@ function thissubmit(thiss){
...
@@ -479,6 +480,14 @@ function thissubmit(thiss){
});
});
</script>
</script>
</div>
<div
class=
"relation_list"
style=
"margin:20px 2px;"
>
<?=
$relation
?>
</div>
</div>
</div>
</div>
<div
class=
"tabsFooter"
>
<div
class=
"tabsFooter"
>
...
...
app/appfront/modules/Catalog/block/product/Index.php
浏览文件 @
6096b9a9
...
@@ -51,7 +51,7 @@ class Index {
...
@@ -51,7 +51,7 @@ class Index {
'custom_option'
=>
$this
->
_product
[
'custom_option'
],
'custom_option'
=>
$this
->
_product
[
'custom_option'
],
'description'
=>
Yii
::
$service
->
store
->
getStoreAttrVal
(
$this
->
_product
[
'description'
],
'description'
),
'description'
=>
Yii
::
$service
->
store
->
getStoreAttrVal
(
$this
->
_product
[
'description'
],
'description'
),
'_id'
=>
$this
->
_product
[
'_id'
],
'_id'
=>
$this
->
_product
[
'_id'
],
'buy_also_buy'
=>
$this
->
getProductBySkus
(
$skus
),
];
];
}
}
...
@@ -275,4 +275,27 @@ class Index {
...
@@ -275,4 +275,27 @@ class Index {
Yii
::
$service
->
page
->
breadcrumbs
->
active
=
false
;
Yii
::
$service
->
page
->
breadcrumbs
->
active
=
false
;
}
}
}
}
protected
function
getProductBySkus
(
$skus
){
$buy_also_buy_sku
=
$this
->
_product
[
'buy_also_buy_sku'
];
if
(
$buy_also_buy_sku
){
$skus
=
explode
(
','
,
$buy_also_buy_sku
);
if
(
is_array
(
$skus
)
&&
!
empty
(
$skus
)){
$filter
[
'select'
]
=
[
'sku'
,
'spu'
,
'name'
,
'image'
,
'price'
,
'special_price'
,
'special_from'
,
'special_to'
,
'url_key'
,
'score'
,
];
$filter
[
'where'
]
=
[
'in'
,
'sku'
,
$skus
];
$products
=
Yii
::
$service
->
product
->
getProducts
(
$filter
);
//var_dump($products);
$products
=
Yii
::
$service
->
category
->
product
->
convertToCategoryInfo
(
$products
);
return
$products
;
}
}
}
}
}
app/appfront/theme/base/front/assets/css/style.css
浏览文件 @
6096b9a9
...
@@ -2344,6 +2344,31 @@ a.next_images {
...
@@ -2344,6 +2344,31 @@ a.next_images {
border
:
1px
dashed
#ccc
;
border
:
1px
dashed
#ccc
;
}
}
#owl-buy-also-buy
.pro_img
img
{
height
:
200px
;
width
:
100%
;
}
#owl-buy-also-buy
.pro_img
a
{
display
:
block
;
height
:
200px
;
padding
:
0
7.5px
;
width
:
180px
;
}
.scrollBox
#owl-buy-also-buy
span
.my_shop_price
{
font-size
:
14px
;
}
.buy_also_buy
{
margin
:
60px
0
0
;
height
:
320px
;}
.buy_also_buy
.scroll_left
{
margin
:
15px
0
;
border-bottom
:
1px
solid
#ccc
;}
.buy_also_buy
.scrollBox
{
height
:
280px
;}
...
...
app/appfront/theme/base/front/catalog/product/index.php
浏览文件 @
6096b9a9
...
@@ -116,7 +116,26 @@
...
@@ -116,7 +116,26 @@
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
<div>
<?php
# tier price 部分。
$buyAlsoBuyView
=
[
'view'
=>
'catalog/product/index/buy_also_buy.php'
];
$buyAlsoBuyParam
=
[
'products'
=>
$buy_also_buy
,
];
?>
<?=
Yii
::
$service
->
page
->
widget
->
render
(
$buyAlsoBuyView
,
$buyAlsoBuyParam
);
?>
</div>
<div
class=
"clear"
></div>
<div
class=
"product_description_info"
>
<div
class=
"product_description_info"
>
<div
class=
"nav"
id=
"nav-container"
>
<div
class=
"nav"
id=
"nav-container"
>
<ul
id=
"nav-box"
>
<ul
id=
"nav-box"
>
<li
class=
"nav_tab cur"
rel=
"description"
>
DESCRIPTION
</li>
<li
class=
"nav_tab cur"
rel=
"description"
>
DESCRIPTION
</li>
...
@@ -283,3 +302,4 @@
...
@@ -283,3 +302,4 @@
<?php
$this
->
registerJs
(
$this
->
blocks
[
'product_info_tab'
],
\
yii\web\View
::
POS_END
);
//将编写的js代码注册到页面底部 ?>
<?php
$this
->
registerJs
(
$this
->
blocks
[
'product_info_tab'
],
\
yii\web\View
::
POS_END
);
//将编写的js代码注册到页面底部 ?>
</
script
>
</
script
>
\ No newline at end of file
app/appfront/theme/base/front/catalog/product/index/buy_also_buy.php
0 → 100644
浏览文件 @
6096b9a9
<?php
if
(
is_array
(
$parentThis
[
'products'
])
&&
!
empty
(
$parentThis
[
'products'
])){
?>
<div
class=
"buy_also_buy"
>
<div
class=
"scroll_left"
>
<a
href=
""
>
Customers Who Bought This Item Also Bought
</a>
</div>
<div
class=
"scrollBox"
>
<div
class=
"viewport"
style=
"overflow: hidden; position: relative;"
>
<div
id=
"owl-buy-also-buy"
class=
"owl-carousel"
>
<?php
foreach
(
$parentThis
[
'products'
]
as
$product
){
?>
<div
class=
"item"
>
<p
class=
"tc pro_img"
>
<a
style=
""
class=
"i_proImg"
href=
"
<?=
$product
[
'url'
]
?>
"
>
<img
style=
"width:100%;"
class=
"lazyOwl"
data-src=
"
<?=
Yii
::
$service
->
product
->
image
->
getResize
(
$product
[
'image'
],[
180
,
200
],
false
)
?>
"
src=
"
<?=
Yii
::
$service
->
image
->
getImgUrl
(
'images/lazyload1.gif'
,
'appfront'
)
;
?>
"
>
</a>
</p>
<!--
<p class="proName">
<a href="
<?=
$product
[
'url'
]
?>
">
<?=
$product
[
'name'
]
?>
</a>
</p>
-->
<?php
$config
=
[
'class'
=>
'fecshop\app\appfront\modules\Catalog\block\category\Price'
,
'view'
=>
'cms/home/index/price.php'
,
'price'
=>
$product
[
'price'
],
'special_price'
=>
$product
[
'special_price'
],
];
echo
Yii
::
$service
->
page
->
widget
->
renderContent
(
'category_product_price'
,
$config
);
?>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<script>
<?php
$this
->
beginBlock
(
'owl_fecshop_slider'
)
?>
$
(
document
).
ready
(
function
(){
$
(
"
#owl-buy-also-buy
"
).
owlCarousel
({
items
:
6
,
lazyLoad
:
true
,
navigation
:
true
,
scrollPerPage
:
true
,
pagination
:
false
,
itemsCustom
:
false
,
slideSpeed
:
900
});
});
<?php
$this
->
endBlock
();
?>
</script>
<?php
$this
->
registerJs
(
$this
->
blocks
[
'owl_fecshop_slider'
],
\
yii\web\View
::
POS_END
);
//将编写的js代码注册到页面底部 ?>
<?
php
}
?>
models/mongodb/Product.php
浏览文件 @
6096b9a9
...
@@ -86,6 +86,9 @@ class Product extends ActiveRecord
...
@@ -86,6 +86,9 @@ class Product extends ActiveRecord
'reviw_rate_star_average_lang'
,
#(语言)评论平均评分
'reviw_rate_star_average_lang'
,
#(语言)评论平均评分
'review_count_lang'
,
#(语言)评论总数
'review_count_lang'
,
#(语言)评论总数
'favorite_count'
,
# 产品被收藏的次数。
'favorite_count'
,
# 产品被收藏的次数。
'relation_sku'
,
# 相关产品
'buy_also_buy_sku'
,
# 买了的还买了什么
'see_also_see_sku'
,
# 看了的还看了什么
];
];
if
(
is_array
(
self
::
$_customProductAttrs
)
&&
!
empty
(
self
::
$_customProductAttrs
)){
if
(
is_array
(
self
::
$_customProductAttrs
)
&&
!
empty
(
self
::
$_customProductAttrs
)){
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录