Date: Sat, 31 Aug 2019 14:37:40 +0530
Subject: [PATCH 08/13] New issue template for filing issue and cut the issue
filing hassle
---
FEATURE_REQUEST_TEMPLATE.md | 66 +++++++++++++++++++++++
ISSUE_TEMPLATE.md | 33 ++++++++++++
SUPPORT_TEMPLATE.md | 48 +++++++++++++++++
packages/Webkul/Admin/src/Config/menu.php | 6 +--
4 files changed, 150 insertions(+), 3 deletions(-)
create mode 100644 FEATURE_REQUEST_TEMPLATE.md
create mode 100644 ISSUE_TEMPLATE.md
create mode 100644 SUPPORT_TEMPLATE.md
diff --git a/FEATURE_REQUEST_TEMPLATE.md b/FEATURE_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..72ac44d98
--- /dev/null
+++ b/FEATURE_REQUEST_TEMPLATE.md
@@ -0,0 +1,66 @@
+
+
+ Feature
+
+
+
+
+
+
Title
+
+
+
+ A well written title should contain a clear, brief explanation of the Feature, making emphasis on the most important points.
+
+
+
+
+
Preconditions
+
+
Please provide as detailed information about your environment as possible.
+
+ - framework Version:
+ - Commit id:
+
+
+
+
+
Description
+
+
Description helps the developer to understand the Feature.
+
+
+
+
+
Steps to reproduce
+
+
It is important to provide a set of clear steps to that location where feature need to be added. If relevant please include code samples.
+
+ - step1
+ - step2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..ba6e43ec7
--- /dev/null
+++ b/ISSUE_TEMPLATE.md
@@ -0,0 +1,33 @@
+# Bug report
+
+### Title
+
+
+ Title is a vital part of bug report for developer and triager to quickly identify a unique issue.
+
+ A well written title should contain a clear, brief explanation of the issue, making emphasis on the most important points.
+
+
+
+### Issue Description
+ Bug description helps the developer to understand the bug.It describes the problem encountered.
+
+### Preconditions
+ Please provide as detailed information about your environment as possible.
+
+ 1. framework Version.
+ 2. Commit id.
+
+### Steps to reproduce
+ It is important to provide a set of clear steps to reproduce this bug.If relevant please include code samples.
+
+ 1. step1
+ 2. step2
+
+### Expected result
+ Tell us what should happen
+* [Screenshots, logs or description]
+
+### Actual result
+ Tell us what happens instead
+ * [Tell us what happens instead]
\ No newline at end of file
diff --git a/SUPPORT_TEMPLATE.md b/SUPPORT_TEMPLATE.md
new file mode 100644
index 000000000..f692a9498
--- /dev/null
+++ b/SUPPORT_TEMPLATE.md
@@ -0,0 +1,48 @@
+
+
+ Support
+
+
+
+
+
+
Title
+
+
+ Title is a vital part of bug report for developer and triager to quickly identify a unique issue.
+
+ A well written title should contain a clear, brief explanation of the issue, making emphasis on the most important points.
+
+
+
+
+
Preconditions
+
+
Please provide as detailed information about your environment as possible.
+
+ - framework Version:
+ - Commit id:
+
+
+
+
+
Description
+
+
Description helps the developer to understand the exact scenario.It describes the problem encountered.
+
+
+
+
Steps to reproduce
+
+
It is important to provide a set of clear steps to reproduce that scenario. If relevant please include code samples.
+
+ - step1
+ - step2
+
+
+
diff --git a/packages/Webkul/Admin/src/Config/menu.php b/packages/Webkul/Admin/src/Config/menu.php
index dd92aa092..6435b5f41 100755
--- a/packages/Webkul/Admin/src/Config/menu.php
+++ b/packages/Webkul/Admin/src/Config/menu.php
@@ -42,7 +42,7 @@ return [
'key' => 'catalog.products',
'name' => 'admin::app.layouts.products',
'route' => 'admin.catalog.products.index',
- 'sort' => 4,
+ 'sort' => 1,
'icon-class' => ''
], [
'key' => 'catalog.categories',
@@ -54,13 +54,13 @@ return [
'key' => 'catalog.attributes',
'name' => 'admin::app.layouts.attributes',
'route' => 'admin.catalog.attributes.index',
- 'sort' => 1,
+ 'sort' => 2,
'icon-class' => ''
], [
'key' => 'catalog.families',
'name' => 'admin::app.layouts.attribute-families',
'route' => 'admin.catalog.families.index',
- 'sort' => 2,
+ 'sort' => 4,
'icon-class' => ''
], [
'key' => 'customers',
From 484f1d7a934fe6562b53bc4f519f26e6424428fa Mon Sep 17 00:00:00 2001
From: Prashant Singh
Date: Sat, 31 Aug 2019 14:39:47 +0530
Subject: [PATCH 09/13] ISSUE_TEMPLATE corrections
---
ISSUE_TEMPLATE.md | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index ba6e43ec7..8dc67d40e 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -1,33 +1,29 @@
# Bug report
### Title
+ **Title is a vital part of bug report for developer and triager to quickly identify a unique issue.**
-
- Title is a vital part of bug report for developer and triager to quickly identify a unique issue.
-
- A well written title should contain a clear, brief explanation of the issue, making emphasis on the most important points.
-
-
+ A well written title should contain a clear, brief explanation of the issue, making emphasis on the most important points.
### Issue Description
- Bug description helps the developer to understand the bug.It describes the problem encountered.
+ **Bug description helps the developer to understand the bug.It describes the problem encountered.**
### Preconditions
- Please provide as detailed information about your environment as possible.
+ **Please provide as detailed information about your environment as possible.**
1. framework Version.
2. Commit id.
### Steps to reproduce
- It is important to provide a set of clear steps to reproduce this bug.If relevant please include code samples.
+ **It is important to provide a set of clear steps to reproduce this bug.If relevant please include code samples.**
1. step1
2. step2
### Expected result
- Tell us what should happen
+ **Tell us what should happen.**
* [Screenshots, logs or description]
### Actual result
- Tell us what happens instead
+ **Tell us what happens instead.**
* [Tell us what happens instead]
\ No newline at end of file
From f78d9e8487a39ae15fc90e572fb7908acd628e48 Mon Sep 17 00:00:00 2001
From: Prashant Singh
Date: Sat, 31 Aug 2019 15:21:10 +0530
Subject: [PATCH 10/13] Fixed the issue #1372
---
.../Discount/src/Helpers/Cart/ConvertXToProductId.php | 9 ++++++++-
.../Discount/src/Http/Controllers/CartRuleController.php | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/packages/Webkul/Discount/src/Helpers/Cart/ConvertXToProductId.php b/packages/Webkul/Discount/src/Helpers/Cart/ConvertXToProductId.php
index 9a356caf2..9f596b845 100644
--- a/packages/Webkul/Discount/src/Helpers/Cart/ConvertXToProductId.php
+++ b/packages/Webkul/Discount/src/Helpers/Cart/ConvertXToProductId.php
@@ -70,9 +70,16 @@ class ConvertXToProductId
$this->conditionSymbols = config('pricerules.cart.conditions.symbols');
}
+ /**
+ * Collects the attribute and category conditions
+ *
+ * @param Integer $ruleId
+ *
+ * @param Object $attrribute_conditions
+ */
public function convertX($ruleId, $attribute_conditions)
{
- $attributeConditions = json_decode($attribute_conditions);
+ $attributeConditions = $attribute_conditions;
$categoryValues = $attributeConditions->categories ?? null;
diff --git a/packages/Webkul/Discount/src/Http/Controllers/CartRuleController.php b/packages/Webkul/Discount/src/Http/Controllers/CartRuleController.php
index 1c98d4b92..3beca8b8c 100644
--- a/packages/Webkul/Discount/src/Http/Controllers/CartRuleController.php
+++ b/packages/Webkul/Discount/src/Http/Controllers/CartRuleController.php
@@ -269,6 +269,7 @@ class CartRuleController extends Controller
// $coupons['limit'] = $data['usage_limit'];
// }
+
// create a cart rule
$ruleCreated = $this->cartRule->create($data);
From c19159ddc239d3606ab1b1c7b61d28602432c9b4 Mon Sep 17 00:00:00 2001
From: Prashant Singh
Date: Sat, 31 Aug 2019 17:20:55 +0530
Subject: [PATCH 11/13] Validation case for cart rule fix, the rule was not
getting deleted from cart and cartrulecart's table
---
packages/Webkul/Discount/src/Helpers/Cart/Discount.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/Webkul/Discount/src/Helpers/Cart/Discount.php b/packages/Webkul/Discount/src/Helpers/Cart/Discount.php
index 6514ecde2..afb761cc9 100644
--- a/packages/Webkul/Discount/src/Helpers/Cart/Discount.php
+++ b/packages/Webkul/Discount/src/Helpers/Cart/Discount.php
@@ -668,7 +668,7 @@ abstract class Discount
if (! $result) {
$this->clearDiscount();
- $alreadyAppliedRule->delete();
+ $alreadyAppliedRule->first()->delete();
} else {
$this->reassess($alreadyAppliedCartRule);
}
From d31d9d991617875db12d4509c1b4a0ee4a0612ae Mon Sep 17 00:00:00 2001
From: Prashant Singh
Date: Sat, 31 Aug 2019 17:59:00 +0530
Subject: [PATCH 12/13] Isolation case for FixedAction in CartRule fixed
---
packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php b/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php
index 419c63722..596a30128 100644
--- a/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php
+++ b/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php
@@ -49,7 +49,7 @@ class FixedAmount extends Action
}
}
} else {
- $discount = round(($itemPrice - $rule->disc_amount), 4);
+ $discount = $rule->disc_amount;
}
if ($itemProductId == $productID) {
@@ -91,7 +91,7 @@ class FixedAmount extends Action
}
}
} else {
- $discount = round(($itemPrice - $rule->disc_amount), 4);
+ $discount = $rule->disc_amount;
}
$totalDiscount = $totalDiscount + $discount;
From f8e9f37c5d6ac921e0b916949b4b98777b63aca8 Mon Sep 17 00:00:00 2001
From: Prashant Singh
Date: Sat, 31 Aug 2019 18:18:28 +0530
Subject: [PATCH 13/13] Current discount actions are normalized again with safe
conditions implemented
---
.../Discount/src/Actions/Cart/FixedAmount.php | 36 +++++++++++--------
.../src/Actions/Cart/PercentOfProduct.php | 24 +++++++++++++
.../src/Actions/Cart/WholeCartToPercent.php | 8 +++++
3 files changed, 54 insertions(+), 14 deletions(-)
diff --git a/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php b/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php
index 596a30128..4a8990ef2 100644
--- a/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php
+++ b/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php
@@ -36,20 +36,24 @@ class FixedAmount extends Action
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
- if ($rule->disc_amount > $itemPrice) {
- $discount = round($rule->disc_amount * $discQuantity, 4);
+ if ($rule->disc_amount >= $itemPrice) {
+ $discount = round($itemPrice * $discQuantity, 4);
} else {
- $discount = $itemPrice;
+ $discount = $rule->disc_amount;
}
} else if ($itemQuantity < $discQuantity) {
- if ($rule->disc_amount > $itemPrice) {
- $discount = round($rule->disc_amount * $itemQuantity, 4);
+ if ($rule->disc_amount >= $itemPrice) {
+ $discount = round($itemPrice * $discQuantity, 4);
} else {
- $discount = $itemPrice;
+ $discount = $rule->disc_amount;
}
}
} else {
- $discount = $rule->disc_amount;
+ if ($rule->disc_amount >= $itemPrice) {
+ $discount = round($itemPrice * $discQuantity, 4);
+ } else {
+ $discount = $rule->disc_amount;
+ }
}
if ($itemProductId == $productID) {
@@ -78,20 +82,24 @@ class FixedAmount extends Action
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
- if ($rule->disc_amount > $itemPrice) {
- $discount = round($rule->disc_amount * $discQuantity, 4);
+ if ($rule->disc_amount >= $itemPrice) {
+ $discount = round($itemPrice * $discQuantity, 4);
} else {
- $discount = $itemPrice;
+ $discount = $rule->disc_amount;
}
} else if ($itemQuantity < $discQuantity) {
- if ($rule->disc_amount > $itemPrice) {
- $discount = round($rule->disc_amount * $itemQuantity, 4);
+ if ($rule->disc_amount >= $itemPrice) {
+ $discount = round($itemPrice * $discQuantity, 4);
} else {
- $discount = $itemPrice;
+ $discount = $rule->disc_amount;
}
}
} else {
- $discount = $rule->disc_amount;
+ if ($rule->disc_amount >= $itemPrice) {
+ $discount = round($itemPrice * $discQuantity, 4);
+ } else {
+ $discount = $rule->disc_amount;
+ }
}
$totalDiscount = $totalDiscount + $discount;
diff --git a/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php b/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php
index 1ad74a6c8..c14b279af 100644
--- a/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php
+++ b/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php
@@ -53,11 +53,23 @@ class PercentOfProduct extends Action
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $discQuantity;
+
+ if ($discount >= $itemPrice) {
+ $discount = $itemPrice;
+ }
} else if ($itemQuantity < $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $itemQuantity;
+
+ if ($discount >= $itemPrice) {
+ $discount = $itemPrice;
+ }
}
} else {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
+
+ if ($discount >= $itemPrice) {
+ $discount = $itemPrice;
+ }
}
if ($itemProductId == $productID) {
@@ -87,11 +99,23 @@ class PercentOfProduct extends Action
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $discQuantity;
+
+ if ($discount >= $itemPrice) {
+ $discount = $itemPrice;
+ }
} else if ($itemQuantity < $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $itemQuantity;
+
+ if ($discount >= $itemPrice) {
+ $discount = $itemPrice;
+ }
}
} else {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
+
+ if ($discount >= $itemPrice) {
+ $discount = $itemPrice;
+ }
}
$totalDiscount = $totalDiscount + $discount;
diff --git a/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php b/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php
index d9f333412..8f2c64f21 100644
--- a/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php
+++ b/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php
@@ -47,6 +47,10 @@ class WholeCartToPercent extends Action
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
+ if ($discount >= $itemPrice) {
+ $discount = $itemPrice;
+ }
+
$totalDiscount = $totalDiscount + $discount;
if ($item->product_id == $productID) {
@@ -76,6 +80,10 @@ class WholeCartToPercent extends Action
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
+ if ($discount > $itemPrice) {
+ $discount = $itemPrice;
+ }
+
$totalDiscount = $totalDiscount + $discount;
$report = array();