Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
d17bfd12
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,发现更多精彩内容 >>
提交
d17bfd12
编写于
8月 30, 2016
作者:
R
root
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fecshop category product
上级
a3a9c089
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
302 addition
and
61 deletion
+302
-61
app/appadmin/modules/Catalog/views/productinfo/manageredit.php
...ppadmin/modules/Catalog/views/productinfo/manageredit.php
+6
-0
app/appfront/modules/Catalog/Module.php
app/appfront/modules/Catalog/Module.php
+11
-0
app/appfront/modules/Catalog/block/category/Index.php
app/appfront/modules/Catalog/block/category/Index.php
+12
-3
app/appfront/modules/Catalog/block/category/Price.php
app/appfront/modules/Catalog/block/category/Price.php
+41
-0
app/appfront/modules/Catalog/controllers/CategoryController.php
...pfront/modules/Catalog/controllers/CategoryController.php
+11
-0
app/appfront/modules/Catalog/helpers/Price.php
app/appfront/modules/Catalog/helpers/Price.php
+43
-0
app/appfront/theme/base/front/assets/css/style.css
app/appfront/theme/base/front/assets/css/style.css
+33
-15
app/appfront/theme/base/front/catalog/category/index.php
app/appfront/theme/base/front/catalog/category/index.php
+73
-42
app/appfront/theme/base/front/catalog/category/price.php
app/appfront/theme/base/front/catalog/category/price.php
+13
-0
services/page/Widget.php
services/page/Widget.php
+1
-1
services/product/Price.php
services/product/Price.php
+58
-0
未找到文件。
app/appadmin/modules/Catalog/views/productinfo/manageredit.php
浏览文件 @
d17bfd12
...
...
@@ -139,6 +139,12 @@ function thissubmit(thiss){
cate_id
=
jQuery
(
this
).
find
(
"
input
"
).
val
();
cate_str
+=
cate_id
+
"
,
"
;
});
jQuery
(
"
.category_tree div.ckbox.indeterminate
"
).
each
(
function
(){
cate_id
=
jQuery
(
this
).
find
(
"
input
"
).
val
();
cate_str
+=
cate_id
+
"
,
"
;
});
jQuery
(
"
.inputcategory
"
).
val
(
cate_str
);
...
...
app/appfront/modules/Catalog/Module.php
浏览文件 @
d17bfd12
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace
fecshop\app\appfront\modules\Catalog
;
use
Yii
;
use
fecshop\app\appfront\modules\AppfrontModule
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
Module
extends
AppfrontModule
{
public
$blockNamespace
;
...
...
app/appfront/modules/Catalog/block/category/Index.php
浏览文件 @
d17bfd12
<?php
/*
* 存放 一些基本的非数据库数据 如 html
* 都是数组
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace
fecshop\app\appfront\modules\Catalog\block\category
;
use
Yii
;
use
fec\helpers\CModule
;
use
fec\helpers\CRequest
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
Index
{
protected
$_category
;
...
...
@@ -25,6 +32,8 @@ class Index {
return
[
'title'
=>
$this
->
_title
,
'name'
=>
Yii
::
$service
->
store
->
getStoreAttrVal
(
$this
->
_category
[
'name'
],
'name'
),
'image'
=>
$this
->
_category
[
'image'
]
?
Yii
::
$service
->
category
->
image
->
getUrl
(
$this
->
_category
[
'image'
])
:
''
,
'description'
=>
Yii
::
$service
->
store
->
getStoreAttrVal
(
$this
->
_category
[
'description'
],
'description'
),
'products'
=>
$this
->
getCategoryProductColl
(),
//'content' => Yii::$service->store->getStoreAttrVal($this->_category['content'],'content'),
//'created_at' => $this->_category['created_at'],
...
...
app/appfront/modules/Catalog/block/category/Price.php
0 → 100644
浏览文件 @
d17bfd12
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace
fecshop\app\appfront\modules\Catalog\block\category
;
use
Yii
;
use
fec\helpers\CModule
;
use
fec\helpers\CRequest
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
Price
{
public
$price
;
public
$special_price
;
public
function
getLastData
(){
$price_info
=
Yii
::
$service
->
product
->
price
->
formatPrice
(
$this
->
price
);
$return
=
[
'price'
=>
[
'symbol'
=>
$price_info
[
'symbol'
],
'value'
=>
$price_info
[
'value'
],
'code'
=>
$price_info
[
'code'
],
]
];
if
(
$this
->
special_price
){
$special_price_info
=
Yii
::
$service
->
product
->
price
->
formatPrice
(
$this
->
special_price
);
$return
[
'special_price'
]
=
[
'symbol'
=>
$special_price_info
[
'symbol'
],
'value'
=>
$special_price_info
[
'value'
],
'code'
=>
$special_price_info
[
'code'
],
];
}
return
$return
;
}
}
\ No newline at end of file
app/appfront/modules/Catalog/controllers/CategoryController.php
浏览文件 @
d17bfd12
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace
fecshop\app\appfront\modules\Catalog\controllers
;
use
Yii
;
use
fec\helpers\CModule
;
use
fec\helpers\CRequest
;
use
fecshop\app\appfront\modules\AppfrontController
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
CategoryController
extends
AppfrontController
{
public
function
init
(){
...
...
app/appfront/modules/Catalog/helpers/Price.php
0 → 100644
浏览文件 @
d17bfd12
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace
fecshop\app\appfront\modules\Catalog\helpers
;
use
Yii
;
use
fec\helpers\CModule
;
use
fec\helpers\CRequest
;
use
fecshop\app\appfront\modules\AppfrontController
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
Price
{
public
function
getCategoryPrice
(
$price
,
$special_price
){
$price_info
=
Yii
::
$service
->
product
->
price
->
format_price
(
$price
);
$return
=
[
'price'
=>
[
'symbol'
=>
$price_info
[
'symbol'
],
'value'
=>
$price_info
[
'value'
],
]
];
if
(
$special_price
){
$special_price_info
=
Yii
::
$service
->
product
->
price
->
format_price
(
$special_price
);
$return
[
'special_price'
]
=
[
'symbol'
=>
$special_price_info
[
'symbol'
],
'value'
=>
$special_price_info
[
'value'
],
];
}
return
$return
;
}
}
\ No newline at end of file
app/appfront/theme/base/front/assets/css/style.css
浏览文件 @
d17bfd12
...
...
@@ -612,21 +612,39 @@ input.input-text {
.top_currency
.currency_list
ul
li
{
cursor
:
pointer
;}
.two-columns-left
.col-main
{
width
:
980px
;
float
:
right
}
.two-columns-left
.col-left
{
width
:
200px
;
float
:
left
}
.col-main
h1
{
font-size
:
15px
;
font-weight
:
100
;}
.category_product
{
margin
:
0
0
15px
0
;}
.category_product
ul
{
margin
:
0
0
10px
;}
.category_product
ul
li
{
float
:
left
;
width
:
240px
;
height
:
350px
;}
.category_product
ul
li
a
{
font-size
:
0.75em
}
.category_product
.c_name
{
min-height
:
50px
;
overflow
:
hidden
}
.category_product
.c_price
.price
{
float
:
left
;
font-weight
:
bold
;
font-size
:
0.9em
;
}
.category_product
.c_price
.special_price
{
float
:
left
;
margin
:
0
0
0
10px
;
font-weight
:
bold
;
font-size
:
0.9em
;
}
.category_product
.c_price
.price.sp
{
text-decoration
:
line-through
;
color
:
777
;
font-weight
:
100
;
}
.menu_category
.toolbar
{
padding
:
8px
15px
;
background
:
#eee
;
margin
:
6px
0
;
height
:
25px
;}
.menu_category
.toolbar
.tb_le
{
float
:
left
;}
.menu_category
.toolbar
.tb_rg
{
float
:
right
;}
.menu_category
.toolbar
.tb_le
b
{
font-size
:
0.8em
}
...
...
app/appfront/theme/base/front/catalog/category/index.php
浏览文件 @
d17bfd12
...
...
@@ -7,52 +7,83 @@
* @license http://www.fecshop.com/license/
*/
?>
<div
class=
"main container"
>
<?php
//var_dump
($products); ?>
<?
php
$count
=
3
;
$end
=
$count
-
1
;
?>
<div
class=
"main container
two-columns-left
"
>
<?php
// echo count
($products); ?>
<?
php
$count
=
4
;
$end
=
$count
-
1
;
?>
<div
class=
"col-main"
>
<h1>
<?=
$name
?>
</h1>
<div
class=
"category_img"
>
</div>
<div
class=
"panelBar"
>
</div>
<div
class=
"category_product"
>
<?php
if
(
is_array
(
$products
)){
?>
<?php
$i
=
0
;
foreach
(
$products
as
$product
){
?>
<?php
if
(
$i
%
$count
==
0
){
?>
<ul>
<?php
}
?>
<li>
<div
class=
"c_img"
>
<a
href=
"
<?=
$product
[
'url'
]
?>
"
>
<img
src=
"
<?=
Yii
::
$service
->
product
->
image
->
getResize
(
$product
[
'image'
],[
280
,
380
],
false
)
?>
"
/>
</a>
</div>
<div
class=
"c_name"
>
<a
href=
"
<?=
$product
[
'url'
]
?>
"
>
<?=
$product
[
'name'
]
?>
</a>
</div>
<div
class=
"c_price"
>
<div
class=
"price"
>
<?=
$product
[
'price'
]
?>
<div
class=
"menu_category"
>
<div
class=
"category_img"
>
<a
href=
"#"
>
<?=
$image
?
'<img style="width:980px;" src="'
.
$image
.
'"/>'
:
''
;
?>
<a>
</div>
<div
class=
"category_description"
>
<h1>
<?=
$name
?>
</h1>
<?=
$description
?>
</div>
<div
class=
"panelBar"
>
<div
class=
"toolbar"
>
<div
class=
"tb_le"
>
<b>
Sort By:
</b>
<select>
<option
value=
"new"
>
New
</option>
<option
value=
"name"
>
Name
</option>
<option
value=
"price"
>
Price
</option>
</select>
<select>
<option
value=
"30"
>
30
</option>
<option
value=
"60"
>
60
</option>
<option
value=
"90"
>
90
</option>
</select>
</div>
<div
class=
"tb_rg"
>
<a
href=
"#"
><
</
a
>
<a
href=
"#"
>
1
</a>
<a
href=
"#"
>
2
</a>
<a
href=
"#"
>
3
</a>
<a
href=
"#"
>
4
</a>
<a
href=
"#"
>
5
</a>
<a
href=
"#"
>
>
</a>
</div>
<div
class=
"clear"
></div>
</div>
</div>
<div
class=
"category_product"
>
<?php
if
(
is_array
(
$products
)){
?>
<?php
$i
=
0
;
foreach
(
$products
as
$product
){
?>
<?php
if
(
$i
%
$count
==
0
){
?>
<ul>
<?php
}
?>
<li>
<div
class=
"c_img"
>
<a
href=
"
<?=
$product
[
'url'
]
?>
"
>
<img
src=
"
<?=
Yii
::
$service
->
product
->
image
->
getResize
(
$product
[
'image'
],[
230
,
230
],
false
)
?>
"
/>
</a>
</div>
<div
class=
"special_price"
>
<?=
$product
[
'special_price'
]
?>
<div
class=
"c_name"
>
<a
href=
"
<?=
$product
[
'url'
]
?>
"
>
<?=
$product
[
'name'
]
?>
</a>
</div>
</div>
</li>
<?php
if
(
$i
%
$count
==
$end
){
?>
</ul>
<?php
}
?>
<?php
$i
++
;
?>
<?php
$config
=
[
'class'
=>
'fecshop\app\appfront\modules\Catalog\block\category\Price'
,
'view'
=>
'catalog/category/price.php'
,
'price'
=>
$product
[
'price'
],
'special_price'
=>
$product
[
'special_price'
],
];
echo
Yii
::
$service
->
page
->
widget
->
renderContent
(
'category_product_price'
,
$config
);
?>
</li>
<?php
if
(
$i
%
$count
==
$end
){
?>
</ul>
<?php
}
?>
<?php
$i
++
;
?>
<?php
}
?>
<?php
if
(
$i
%
$count
!=
$end
){
?>
</ul>
<?php
}
?>
<?php
}
?>
<?php
if
(
$i
%
$count
!=
$end
){
?>
</ul>
<?php
}
?>
<?php
}
?>
</div>
</div>
</div>
...
...
app/appfront/theme/base/front/catalog/category/price.php
0 → 100644
浏览文件 @
d17bfd12
<div
class=
"c_price"
>
<?php
if
(
isset
(
$special_price
)
&&
!
empty
(
$special_price
)){
$sp
=
'sp'
;
}
?>
<div
class=
"price
<?=
$sp
?>
"
>
<?=
$price
[
'symbol'
]
.
$price
[
'value'
]
?>
</div>
<?php
if
(
isset
(
$special_price
)
&&
!
empty
(
$special_price
)){
?>
<div
class=
"special_price"
>
<?=
$special_price
[
'symbol'
]
.
$special_price
[
'value'
]
?>
</div>
<div
class=
"clear"
></div>
<?php
}
?>
</div>
\ No newline at end of file
services/page/Widget.php
浏览文件 @
d17bfd12
...
...
@@ -94,7 +94,7 @@ class Widget extends Service
}
protected
function
r
enderContent
(
$configKey
,
$config
,
$parentThis
=
''
){
protected
function
actionR
enderContent
(
$configKey
,
$config
,
$parentThis
=
''
){
if
(
isset
(
$config
[
'cache'
][
'enable'
])
&&
$config
[
'cache'
][
'enable'
]){
if
(
!
isset
(
$config
[
'class'
])
||
!
$config
[
'class'
]){
throw
new
InvalidConfigException
(
'in widget ['
.
$configKey
.
'],you enable cache ,you must config widget class .'
);
...
...
services/product/Price.php
浏览文件 @
d17bfd12
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace
fecshop\services\product
;
use
Yii
;
use
yii\base\InvalidValueException
;
use
yii\base\InvalidConfigException
;
use
fecshop\services\Service
;
/**
* Product Service is the component that you can get product info from it.
* @property Image|\fecshop\services\Product\Image $image ,This property is read-only.
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
Price
extends
Service
{
protected
$_currencyInfo
;
protected
function
actionFormatPrice
(
$price
){
$currencyInfo
=
$this
->
getCurrentInfo
();
$price
=
$price
*
$currencyInfo
[
'rate'
];
$price
=
ceil
(
$price
*
100
)
/
100
;
return
[
'code'
=>
$currencyInfo
[
'code'
],
'symbol'
=>
$currencyInfo
[
'symbol'
],
'value'
=>
$price
,
];
}
protected
function
getCurrentInfo
(){
if
(
!
$this
->
_currencyInfo
){
$this
->
_currencyInfo
=
Yii
::
$service
->
page
->
currency
->
getCurrencyInfo
();
}
return
$this
->
_currencyInfo
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录