Skip to content

Commit

Permalink
Merge pull request #18 from JackieDo/v3.0
Browse files Browse the repository at this point in the history
Fix bugs
  • Loading branch information
JackieDo authored Jun 4, 2020
2 parents d1e6734 + 9c4ada9 commit ea08295
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ public function isCommercialCart()

/**
* Determines if current cart is enabled built-in tax system
* This is only possible if the cart is empty
*
* @return boolean
*/
Expand Down Expand Up @@ -784,7 +783,7 @@ public function getTaxRate()
}

/**
* Get the total tax rate applied to the current cart.
* Get the total tax amount applied to the current cart.
*
* @return float
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
|--------------------------------------------------------------------------
|
| This setting allows you to set the default state of using the built-in
| tax system or not every time you create a new cart
| taxing system or not every time you initialize the cart.
|
*/
'use_builtin_tax' => true,
Expand Down Expand Up @@ -65,7 +65,7 @@
'taxable' => true,
'allow_others_disable' => true,
'disable_others' => null,
'include_calculations' => 'previous_actions',
'include_calculations' => 'same_group_previous_actions',
'max_amount' => null,
'min_amount' => null
],
Expand All @@ -75,7 +75,7 @@
| Action groups order
|--------------------------------------------------------------------------
|
| This setting allows to prioritize groups of actions in ascending order.
| This setting allows to prioritize groups of actions in descending order.
| If not set, actions will be sorted according to the time of applied. In
| contrast, the actions will be sorted by groups order first, then sorted
| by the time of applied.
Expand Down
14 changes: 10 additions & 4 deletions src/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class Item implements CartNode
'taxable' => true,
'options' => [],
'extra_info' => [],
'applied_actions' => null
];

/**
Expand All @@ -46,6 +45,13 @@ class Item implements CartNode
ItemsContainer::class
];

/**
* Stores applied actions
*
* @var Illuminate\Support\Collection
*/
protected $appliedActions;

/**
* Indicates whether or not this item belong to a commercial cart
*
Expand Down Expand Up @@ -166,7 +172,7 @@ public function getFilterValues()
{
return array_merge([
'hash' => $this->getHash()
], Arr::except($this->attributes, ['applied_actions']));
], $this->attributes);
}

/**
Expand Down Expand Up @@ -321,7 +327,7 @@ protected function initAttributes(array $attributes = [])
$this->setAttributes($attributes);

// Creates the actions container
$this->attributes['applied_actions'] = new ActionsContainer;
$this->appliedActions = new ActionsContainer;

return $this;
}
Expand Down Expand Up @@ -438,7 +444,7 @@ protected function setOptions(array $options = [])
protected function getActionsContainer()
{
if ($this->inCommercialCart) {
return $this->attributes['applied_actions'];
return $this->appliedActions;
}

return new ActionsContainer;
Expand Down

0 comments on commit ea08295

Please sign in to comment.