Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
12ffab3a
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
17
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,体验更适合开发者的 AI 搜索 >>
提交
12ffab3a
编写于
5月 07, 2018
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
trace cart更改
上级
d9b594e0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
6 deletion
+10
-6
services/cart/QuoteItem.php
services/cart/QuoteItem.php
+10
-6
未找到文件。
services/cart/QuoteItem.php
浏览文件 @
12ffab3a
...
@@ -87,7 +87,9 @@ class QuoteItem extends Service
...
@@ -87,7 +87,9 @@ class QuoteItem extends Service
// 重新计算购物车的数量,并写入sales_flat_cart表存储
// 重新计算购物车的数量,并写入sales_flat_cart表存储
Yii
::
$service
->
cart
->
quote
->
computeCartInfo
();
Yii
::
$service
->
cart
->
quote
->
computeCartInfo
();
}
}
$his
->
sendTraceAddToCartInfoByApi
(
$item
);
$item
[
'afterAddQty'
]
=
$item_one
->
qty
;
$this
->
sendTraceAddToCartInfoByApi
(
$item
);
}
}
/**
/**
...
@@ -95,20 +97,21 @@ class QuoteItem extends Service
...
@@ -95,20 +97,21 @@ class QuoteItem extends Service
* $item = [
* $item = [
* 'product_id' => 22222,
* 'product_id' => 22222,
* 'custom_option_sku' => red-xxl,
* 'custom_option_sku' => red-xxl,
* 'qty' => 22,
* 'qty' => 22,
// 添加购物车的产品个数
* 'sku' => 'xxxx',
* 'sku' => 'xxxx',
* 'afterAddQty' => 33, // 添加后,该产品在sku中的个数,这个个数是为了计算购物车中产品的价格
* ];
* ];
* 将加入购物车的操作,加入trace
* 将加入购物车的操作,加入trace
*/
*/
public
function
sendTraceAddToCartInfoByApi
(
$item
){
public
function
sendTraceAddToCartInfoByApi
(
$item
){
if
(
Yii
::
$service
->
page
->
trace
->
traceJsEnable
)
{
if
(
Yii
::
$service
->
page
->
trace
->
traceJsEnable
)
{
$product_price_arr
=
Yii
::
$service
->
product
->
price
->
getCartPriceByProductId
(
$item
[
'product_id'
],
$item
[
'
q
ty'
],
$item
[
'custom_option_sku'
],
2
);
$product_price_arr
=
Yii
::
$service
->
product
->
price
->
getCartPriceByProductId
(
$item
[
'product_id'
],
$item
[
'
afterAddQ
ty'
],
$item
[
'custom_option_sku'
],
2
);
$base_product_price
=
isset
(
$product_price_arr
[
'base_price'
])
?
$product_price_arr
[
'base_price'
]
:
0
;
$base_product_price
=
isset
(
$product_price_arr
[
'base_price'
])
?
$product_price_arr
[
'base_price'
]
:
0
;
$price
=
$base_product_price
*
$item
[
'qty'
];
//
$price = $base_product_price * $item['qty'];
$trace_cart_info
=
[
$trace_cart_info
=
[
[
[
'sku'
=>
$item
[
'sku'
],
'sku'
=>
$item
[
'sku'
],
'price'
=>
$price
,
'price'
=>
$
base_product_
price
,
'qty'
=>
$item
[
'qty'
],
'qty'
=>
$item
[
'qty'
],
]
]
];
];
...
@@ -328,9 +331,10 @@ class QuoteItem extends Service
...
@@ -328,9 +331,10 @@ class QuoteItem extends Service
'custom_option_sku'
=>
$one
[
'custom_option_sku'
],
'custom_option_sku'
=>
$one
[
'custom_option_sku'
],
'qty'
=>
$changeQty
,
'qty'
=>
$changeQty
,
'sku'
=>
$product
[
'sku'
],
'sku'
=>
$product
[
'sku'
],
'afterAddQty'
=>
$one
[
'qty'
],
];
];
// 购物车数据加1
// 购物车数据加1
$his
->
sendTraceAddToCartInfoByApi
(
$item
);
$
t
his
->
sendTraceAddToCartInfoByApi
(
$item
);
return
true
;
return
true
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录