foodbot-cart-calculations 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -125,7 +125,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
125
125
|
if (offer.offer_discount_type != 'manual')
|
|
126
126
|
if (offer.offer_products.package_items) {
|
|
127
127
|
offer.offer_products.package_items = offer.offer_products.package_items.map(function (x) {
|
|
128
|
-
return
|
|
128
|
+
return (x);
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
@@ -134,7 +134,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
134
134
|
|
|
135
135
|
let foundItemsSum = 0
|
|
136
136
|
carts.item_details.filter((res) => {
|
|
137
|
-
if (!res.event && (offer.offer_discount_type == 'manual' || (offer.offer_products.offer_discount_products.includes(
|
|
137
|
+
if (!res.event && (offer.offer_discount_type == 'manual' || (offer.offer_products.offer_discount_products.includes((res.item_id)) && res.isPackage == 0) || (offer.offer_products.package_items.includes((res.item_id)) && res.isPackage == 1))) {
|
|
138
138
|
|
|
139
139
|
foundItemsSum = foundItemsSum + res.item_price_with_modifier * res.quantity
|
|
140
140
|
return foundItemsSum
|
|
@@ -145,7 +145,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
145
145
|
let remaningOfferAmount = offerAmount
|
|
146
146
|
carts.item_details.forEach((element, index) => {
|
|
147
147
|
|
|
148
|
-
if (!element.event && (offer.offer_discount_type == 'manual' || (offer.offer_products.offer_discount_products.includes(
|
|
148
|
+
if (!element.event && (offer.offer_discount_type == 'manual' || (offer.offer_products.offer_discount_products.includes((element.item_id)) && element.isPackage == 0) || (offer.offer_products.package_items.includes((element.item_id)) && element.isPackage == 1))) {
|
|
149
149
|
var itemAmount = 0;
|
|
150
150
|
|
|
151
151
|
// Apply discount on Packages
|
|
@@ -732,10 +732,10 @@ function addItemQuantity(items, offer) {
|
|
|
732
732
|
try {
|
|
733
733
|
var finalItems = [];
|
|
734
734
|
var count = 0;
|
|
735
|
-
offer.offer_products.offer_buy_products=offer.offer_products.offer_buy_products.map(item =>
|
|
736
|
-
offer.offer_products.offer_get_products=offer.offer_products.offer_get_products.map(item =>
|
|
735
|
+
offer.offer_products.offer_buy_products=offer.offer_products.offer_buy_products.map(item => (item));
|
|
736
|
+
offer.offer_products.offer_get_products=offer.offer_products.offer_get_products.map(item => (item));
|
|
737
737
|
items.forEach(function (element) {
|
|
738
|
-
if (offer.offer_products.offer_buy_products.includes(
|
|
738
|
+
if (offer.offer_products.offer_buy_products.includes((element.item_id)) || offer.offer_products.offer_get_products.includes((element.item_id))) {
|
|
739
739
|
for (var i = 1; i <= element.quantity; i++) {
|
|
740
740
|
if (offer.offer_products.order_modifiercost_use == 1) {
|
|
741
741
|
var amount = element.item_price;
|
|
@@ -744,7 +744,7 @@ function addItemQuantity(items, offer) {
|
|
|
744
744
|
amount = element.item_price_with_modifier;
|
|
745
745
|
} else {
|
|
746
746
|
offer.offer_products.modifier_category = offer.offer_products.modifier_category.map(function (x) {
|
|
747
|
-
return
|
|
747
|
+
return (x);
|
|
748
748
|
});
|
|
749
749
|
var modifiers = [];
|
|
750
750
|
element.item_modifiers.forEach(function (modifier) {
|
|
@@ -761,8 +761,8 @@ function addItemQuantity(items, offer) {
|
|
|
761
761
|
'item_id': element.item_id,
|
|
762
762
|
'amount': amount,
|
|
763
763
|
'item': item,
|
|
764
|
-
'buy': offer.offer_products.offer_buy_products.includes(
|
|
765
|
-
'get': offer.offer_products.offer_get_products.includes(
|
|
764
|
+
'buy': offer.offer_products.offer_buy_products.includes((element.item_id)),
|
|
765
|
+
'get': offer.offer_products.offer_get_products.includes((element.item_id))
|
|
766
766
|
});
|
|
767
767
|
} else {
|
|
768
768
|
finalItems.push({
|
|
@@ -770,8 +770,8 @@ function addItemQuantity(items, offer) {
|
|
|
770
770
|
'item_id': element.item_id,
|
|
771
771
|
// / element.quantity
|
|
772
772
|
'amount': element.item_price,
|
|
773
|
-
'buy': offer.offer_products.offer_buy_products.includes(
|
|
774
|
-
'get': offer.offer_products.offer_get_products.includes(
|
|
773
|
+
'buy': offer.offer_products.offer_buy_products.includes((element.item_id)),
|
|
774
|
+
'get': offer.offer_products.offer_get_products.includes((element.item_id))
|
|
775
775
|
});
|
|
776
776
|
}
|
|
777
777
|
}
|
|
@@ -832,7 +832,7 @@ function getFreeProductOffer(cartObject, offer) {
|
|
|
832
832
|
cartItem.forEach((element, index) => {
|
|
833
833
|
var ItemIndex = carts.findIndex((x) => x.item_id == element.item_id && !x.remove);
|
|
834
834
|
|
|
835
|
-
if (offer.offer_products.offer_discount_products.includes(
|
|
835
|
+
if (offer.offer_products.offer_discount_products.includes((element.item_id))) {
|
|
836
836
|
var offerAmount = 0;
|
|
837
837
|
let costWithOutModifier = 0;
|
|
838
838
|
var singleItemCost = element.item_price;
|
|
@@ -852,7 +852,7 @@ function getFreeProductOffer(cartObject, offer) {
|
|
|
852
852
|
});
|
|
853
853
|
} else {
|
|
854
854
|
offer.offer_products.modifier_category = offer.offer_products.modifier_category.map(function (x) {
|
|
855
|
-
return
|
|
855
|
+
return (x);
|
|
856
856
|
});
|
|
857
857
|
|
|
858
858
|
element.item_modifiers.forEach((modifier, modiIndex) => {
|
|
@@ -949,7 +949,7 @@ function getFixedPriceProductOffer(cartObject, offer) {
|
|
|
949
949
|
|
|
950
950
|
cartItem.forEach((element, index) => {
|
|
951
951
|
var ItemIndex = carts.findIndex((x) => x.item_id == element.item_id && !x.remove);
|
|
952
|
-
if (offer.offer_products.offer_discount_products.includes(
|
|
952
|
+
if (offer.offer_products.offer_discount_products.includes((element.item_id)) || offer.offer_products.package_items.includes((element.item_id))) {
|
|
953
953
|
var offerAmount = 0;
|
|
954
954
|
var singleItemCost = element.item_price;
|
|
955
955
|
|
package/package.json
CHANGED