Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
laravelshoppingcart
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
package
laravelshoppingcart
Commits
b26c5875
Commit
b26c5875
authored
Mar 28, 2019
by
Thomas Bilk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some minor changes with regards to new price conditions
parent
3ac51f09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
Cart.php
src/Cart/Cart.php
+14
-10
No files found.
src/Cart/Cart.php
View file @
b26c5875
...
@@ -542,20 +542,21 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
...
@@ -542,20 +542,21 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
public
function
totalOnlyConditions
(
$type
=
null
)
{
public
function
totalOnlyConditions
(
$type
=
null
)
{
$subTotal
=
$this
->
subTotal
();
$subTotal
=
$this
->
subTotal
();
$cond
=
$type
$cond
itions
=
$type
?
$this
->
getConditionsByType
(
$type
)
?
$this
->
getConditionsByType
(
$type
)
:
$this
->
getConditions
()
:
$this
->
getConditions
();
;
$itemConditionTotal
=
$this
->
totalItemsOnlyConditions
(
$type
);
$itemConditionTotal
=
$this
->
totalItemsOnlyConditions
(
$type
);
if
(
$cond
->
isEmpty
())
if
(
$cond
itions
->
isEmpty
())
{
return
$itemConditionTotal
;
return
$itemConditionTotal
;
}
$condTotal
=
$cond
->
sum
(
function
(
$cond
)
use
(
$subTotal
)
{
$condTotal
=
$conditions
/** @var Condition $cond */
->
filter
(
function
(
Condition
$cond
)
{
return
$cond
->
getTarget
()
===
Condition
::
TARGET_CART
return
$cond
->
getTarget
()
===
Condition
::
TARGET_CART
;
?
$cond
->
applyCondition
(
$subTotal
)
})
:
0
;
->
sum
(
function
(
Condition
$cond
)
use
(
$subTotal
)
{
});
return
$cond
->
applyCondition
(
$subTotal
);
});
return
$itemConditionTotal
+
$condTotal
;
return
$itemConditionTotal
+
$condTotal
;
}
}
...
@@ -577,6 +578,9 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
...
@@ -577,6 +578,9 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
*/
*/
public
function
totalConditionsList
(
$withItemConditions
=
true
)
{
public
function
totalConditionsList
(
$withItemConditions
=
true
)
{
return
$this
->
getConditions
(
$withItemConditions
)
return
$this
->
getConditions
(
$withItemConditions
)
->
reject
(
function
(
Condition
$c
)
{
return
$c
->
getTarget
()
==
Condition
::
TARGET_PRICE
;
})
->
map
(
function
(
Condition
$i
)
{
->
map
(
function
(
Condition
$i
)
{
return
$i
->
getType
();
return
$i
->
getType
();
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment