From b5741d6ad7457bd2cf5ea6ed7aac9b8784b1e527 Mon Sep 17 00:00:00 2001 From: JackieDo Date: Wed, 3 Jun 2020 06:20:05 +0700 Subject: [PATCH 1/4] Update Cart.php Update DocBlockr of the method getTaxAmount() --- src/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cart.php b/src/Cart.php index e448979..3e700a9 100644 --- a/src/Cart.php +++ b/src/Cart.php @@ -784,7 +784,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 */ From 5b81481b4419a524434688d114099bc5fcc380b6 Mon Sep 17 00:00:00 2001 From: JackieDo Date: Fri, 5 Jun 2020 06:41:58 +0700 Subject: [PATCH 2/4] Update config.php - Fix comments. - Change default values. --- src/Config/config.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Config/config.php b/src/Config/config.php index 4d71ac5..07ee0ed 100644 --- a/src/Config/config.php +++ b/src/Config/config.php @@ -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, @@ -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 ], @@ -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. From ed69c9cb9f70fb3a4f88c19bc3944b85b1f749d3 Mon Sep 17 00:00:00 2001 From: JackieDo Date: Fri, 5 Jun 2020 06:43:32 +0700 Subject: [PATCH 3/4] Update Item.php Remove actions container from attributes property. --- src/Item.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Item.php b/src/Item.php index a7291f3..e762a85 100644 --- a/src/Item.php +++ b/src/Item.php @@ -34,7 +34,6 @@ class Item implements CartNode 'taxable' => true, 'options' => [], 'extra_info' => [], - 'applied_actions' => null ]; /** @@ -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 * @@ -166,7 +172,7 @@ public function getFilterValues() { return array_merge([ 'hash' => $this->getHash() - ], Arr::except($this->attributes, ['applied_actions'])); + ], $this->attributes); } /** @@ -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; } @@ -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; From 9c4ada9135feae605cb1ae90e483250e5d721f03 Mon Sep 17 00:00:00 2001 From: JackieDo Date: Fri, 5 Jun 2020 06:44:01 +0700 Subject: [PATCH 4/4] Update Cart.php Fix DocBlockr --- src/Cart.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Cart.php b/src/Cart.php index 3e700a9..85316d9 100644 --- a/src/Cart.php +++ b/src/Cart.php @@ -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 */