Error added to accordian if closed
This commit is contained in:
commit
0b22ca7ad1
|
|
@ -64,7 +64,7 @@ Bagisto is using power of both of these frameworks and making best out of it out
|
|||
* **OS**: Ubuntu 16.04 LTS or higher / Windows 7 or Higher (WAMP / XAMP).
|
||||
* **SERVER**: Apache 2 or NGINX.
|
||||
* **RAM**: 3 GB or higher.
|
||||
* **PHP**: 7.2 or higher.
|
||||
* **PHP**: 7.1.3 or higher.
|
||||
* **Processor**: Clock Cycle 1 Ghz or higher.
|
||||
* **For MySQL users**: 5.7.23 or higher.
|
||||
* **For MariaDB users**: 10.2.7 or Higher.
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
"ext-pdo": "*",
|
||||
"ext-pdo_mysql": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"barryvdh/laravel-dompdf": "^0.8.0@dev",
|
||||
"barryvdh/laravel-dompdf": "0.8.3",
|
||||
"dimsav/laravel-translatable": "^9.0",
|
||||
"doctrine/dbal": "^2.9@dev",
|
||||
"doctrine/dbal": "2.9.2",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"flynsarmy/db-blade-compiler": "*",
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
"maatwebsite/excel": "3.1.11",
|
||||
"nwidart/laravel-modules": "^3.2",
|
||||
"prettus/l5-repository": "2.6.32",
|
||||
"tymon/jwt-auth": "dev-develop"
|
||||
"tymon/jwt-auth": "1.0.0-rc.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.1",
|
||||
|
|
@ -100,7 +100,8 @@
|
|||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": [
|
||||
"barryvdh/laravel-debugbar"
|
||||
"barryvdh/laravel-debugbar",
|
||||
"laravel/dusk"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -122,4 +123,4 @@
|
|||
"optimize-autoloader": true
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -39,6 +39,8 @@ $(document).ready(function () {
|
|||
e.target.submit();
|
||||
} else {
|
||||
this.toggleButtonDisable(false);
|
||||
|
||||
eventBus.$emit('onFormError')
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -117,8 +117,10 @@
|
|||
@endif
|
||||
|
||||
window.serverErrors = [];
|
||||
@if (count($errors))
|
||||
window.serverErrors = @json($errors->getMessages());
|
||||
@if (isset($errors))
|
||||
@if (count($errors))
|
||||
window.serverErrors = @json($errors->getMessages());
|
||||
@endif
|
||||
@endif
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@
|
|||
</div> --}}
|
||||
|
||||
<div class="control-group" :class="[errors.has('disc_quantity') ? 'has-error' : '']">
|
||||
<label for="disc_amount" class="required">{{ __('admin::app.promotion.general-info.disc_qty') }}</label>
|
||||
<label for="disc_quantity" class="required">{{ __('admin::app.promotion.general-info.disc_qty') }}</label>
|
||||
|
||||
<input type="number" step="1" class="control" name="disc_quantity" v-model="disc_quantity" v-validate="'required|decimal|min_value:1'" value="{{ old('disc_quantity') }}" data-vv-as=""{{ __('admin::app.promotion.general-info.disc_qty') }}"">
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { mix } = require("laravel-mix");
|
||||
const mix = require("laravel-mix");
|
||||
require("laravel-mix-merge-manifest");
|
||||
|
||||
if (mix.inProduction()) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
use Webkul\Core\Core;
|
||||
|
||||
|
||||
if (! function_exists('core')) {
|
||||
function core()
|
||||
{
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
$results = array_merge($results, $append);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,34 @@ namespace Webkul\Discount\Actions;
|
|||
abstract class Action
|
||||
{
|
||||
abstract public function calculate($rule);
|
||||
|
||||
public function getProductIDs($rule)
|
||||
{
|
||||
$cart = \Cart::getCart();
|
||||
$items = $cart->items;
|
||||
|
||||
$matchedItems = collect();
|
||||
|
||||
$productIDs = $rule->product_ids;
|
||||
|
||||
$productIDs = explode(',', $productIDs);
|
||||
|
||||
$matchCriteria = $rule->uses_attribute_conditions ? $rule->product_ids : '*';
|
||||
|
||||
if ($matchCriteria == '*') {
|
||||
return $items;
|
||||
} else {
|
||||
$matchingIDs = explode(',', $matchCriteria);
|
||||
|
||||
foreach ($items as $item) {
|
||||
foreach ($matchingIDs as $matchingID) {
|
||||
if ($matchingID == $item->child ? $item->child->product_id : $item->product_id) {
|
||||
$matchedItems->push($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $matchedItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,98 +8,48 @@ class FixedAmount extends Action
|
|||
{
|
||||
public function calculate($rule)
|
||||
{
|
||||
$cart = \Cart::getCart();
|
||||
$items = $cart->items;
|
||||
|
||||
$impact = collect();
|
||||
|
||||
$totalDiscount = 0;
|
||||
|
||||
if ($rule->uses_attribute_conditions) {
|
||||
$productIDs = $rule->product_ids;
|
||||
$eligibleItems = $this->getProductIDs($rule);
|
||||
|
||||
$productIDs = explode(',', $productIDs);
|
||||
$apply = function () use ($rule, $eligibleItems) {
|
||||
if ($rule->action_type == 'fixed_amount') {
|
||||
return true;
|
||||
} else {
|
||||
if ($rule->action_type == 'whole_cart_to_fixed' && $rule->uses_attribute_condition) {
|
||||
$matchIDs = explode(',', $rule->product_ids);
|
||||
|
||||
foreach ($productIDs as $productID) {
|
||||
foreach ($items as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
if ($item->product->type == 'configurable') {
|
||||
$itemProductId = $item->child->product_id;
|
||||
} else {
|
||||
$itemProductId = $item->product_id;
|
||||
}
|
||||
|
||||
$itemQuantity = $item->quantity;
|
||||
|
||||
$discQuantity = $rule->disc_quantity;
|
||||
|
||||
if ($discQuantity > 1) {
|
||||
if ($itemQuantity >= $discQuantity) {
|
||||
if ($rule->disc_amount >= $itemPrice) {
|
||||
$discount = round($itemPrice * $discQuantity, 4);
|
||||
} else {
|
||||
$discount = $rule->disc_amount;
|
||||
}
|
||||
} else if ($itemQuantity < $discQuantity) {
|
||||
if ($rule->disc_amount >= $itemPrice) {
|
||||
$discount = round($itemPrice * $discQuantity, 4);
|
||||
} else {
|
||||
$discount = $rule->disc_amount;
|
||||
foreach ($matchIDs as $matchID) {
|
||||
foreach ($eligibleItems as $item) {
|
||||
if ($item->child ? $item->child->product_id : $item->product_id == $matchID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($rule->disc_amount >= $itemPrice) {
|
||||
$discount = round($itemPrice * $discQuantity, 4);
|
||||
} else {
|
||||
$discount = $rule->disc_amount;
|
||||
}
|
||||
}
|
||||
|
||||
if ($itemProductId == $productID) {
|
||||
$totalDiscount = $totalDiscount + $discount;
|
||||
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
|
||||
$report['discount'] = $discount;
|
||||
$report['formatted_discount'] = core()->currency($discount);
|
||||
|
||||
$impact->push($report);
|
||||
|
||||
unset($report);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($items as $item) {
|
||||
};
|
||||
|
||||
if ($apply()) {
|
||||
foreach ($eligibleItems as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
$itemQuantity = $item->quantity;
|
||||
|
||||
$discQuantity = $rule->disc_quantity;
|
||||
|
||||
if ($discQuantity > 1) {
|
||||
if ($itemQuantity >= $discQuantity) {
|
||||
if ($rule->disc_amount >= $itemPrice) {
|
||||
$discount = round($itemPrice * $discQuantity, 4);
|
||||
} else {
|
||||
$discount = $rule->disc_amount;
|
||||
}
|
||||
} else if ($itemQuantity < $discQuantity) {
|
||||
if ($rule->disc_amount >= $itemPrice) {
|
||||
$discount = round($itemPrice * $discQuantity, 4);
|
||||
} else {
|
||||
$discount = $rule->disc_amount;
|
||||
}
|
||||
}
|
||||
$discQuantity = $itemQuantity <= $discQuantity ? $itemQuantity : $discQuantity;
|
||||
|
||||
if ($rule->disc_amount >= $itemPrice) {
|
||||
$discount = round($itemPrice * $discQuantity, 4);
|
||||
} else {
|
||||
if ($rule->disc_amount >= $itemPrice) {
|
||||
$discount = round($itemPrice * $discQuantity, 4);
|
||||
} else {
|
||||
$discount = $rule->disc_amount;
|
||||
}
|
||||
$discount = $rule->disc_amount;
|
||||
}
|
||||
|
||||
$totalDiscount = $totalDiscount + $discount;
|
||||
|
|
@ -123,7 +73,6 @@ class FixedAmount extends Action
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$impact->discount = $totalDiscount;
|
||||
$impact->formatted_discount = core()->currency($impact->discount);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,143 +6,77 @@ use Webkul\Discount\Actions\Action;
|
|||
|
||||
class PercentOfProduct extends Action
|
||||
{
|
||||
/**
|
||||
* To calculate impact of cart rule's action of current items of cart instance
|
||||
*
|
||||
* @param CartRule $rule
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function calculate($rule)
|
||||
{
|
||||
$cart = \Cart::getCart();
|
||||
$items = $cart->items;
|
||||
|
||||
$impact = collect();
|
||||
|
||||
$totalDiscount = 0;
|
||||
|
||||
if ($rule->discount_amount >= 100) {
|
||||
$impact->discount = $cart->base_sub_total;
|
||||
$eligibleItems = $this->getProductIDs($rule);
|
||||
|
||||
$impact->formatted_discount = core()->currency($impact->discount);
|
||||
}
|
||||
$apply = function () use($rule, $eligibleItems) {
|
||||
if ($rule->action_type == 'percent_of_product') {
|
||||
return true;
|
||||
} else {
|
||||
if ($rule->action_type == 'whole_cart_to_percent' && $rule->uses_attribute_condition) {
|
||||
$matchIDs = explode(',', $rule->product_ids);
|
||||
|
||||
if ($rule->uses_attribute_conditions) {
|
||||
$productIDs = $rule->product_ids;
|
||||
|
||||
$productIDs = explode(',', $productIDs);
|
||||
|
||||
// $matchCount = 0;
|
||||
|
||||
// foreach ($productIDs as $productID) {
|
||||
// foreach ($items as $item) {
|
||||
// if ($item->product_id == $productID) {
|
||||
// $matchCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
foreach ($productIDs as $productID) {
|
||||
foreach ($items as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
if ($item->product->type == 'configurable') {
|
||||
$itemProductId = $item->child->product_id;
|
||||
} else {
|
||||
$itemProductId = $item->product_id;
|
||||
}
|
||||
|
||||
$itemQuantity = $item->quantity;
|
||||
|
||||
$discQuantity = $rule->disc_quantity;
|
||||
|
||||
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;
|
||||
foreach ($matchIDs as $matchID) {
|
||||
foreach ($eligibleItems as $item) {
|
||||
if ($item->child ? $item->child->product_id : $item->product_id == $matchID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
|
||||
|
||||
if ($discount >= $itemPrice) {
|
||||
$discount = $itemPrice;
|
||||
}
|
||||
}
|
||||
|
||||
if ($itemProductId == $productID) {
|
||||
$totalDiscount = $totalDiscount + $discount;
|
||||
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
|
||||
$report['discount'] = $discount;
|
||||
$report['formatted_discount'] = core()->currency($discount);
|
||||
|
||||
$impact->push($report);
|
||||
|
||||
unset($report);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($items as $item) {
|
||||
};
|
||||
|
||||
if ($apply()) {
|
||||
foreach ($eligibleItems as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
$itemQuantity = $item->quantity;
|
||||
|
||||
$discQuantity = $rule->disc_quantity;
|
||||
|
||||
if ($discQuantity > 1) {
|
||||
if ($itemQuantity >= $discQuantity) {
|
||||
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $discQuantity;
|
||||
$discQuantity = $itemQuantity <= $discQuantity ? $itemQuantity : $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;
|
||||
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
|
||||
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
|
||||
|
||||
if ($discount <= $itemPrice) {
|
||||
$report['discount'] = $discount;
|
||||
} else {
|
||||
$report['discount'] = $itemPrice;
|
||||
}
|
||||
$discount = $discount <= $itemPrice ? $discount : $itemPrice;
|
||||
|
||||
$report['discount'] = $discount;
|
||||
|
||||
$report['formatted_discount'] = core()->currency($discount);
|
||||
|
||||
$impact->push($report);
|
||||
|
||||
$totalDiscount = $totalDiscount + $discount;
|
||||
|
||||
unset($report);
|
||||
}
|
||||
|
||||
$impact->discount = $totalDiscount;
|
||||
$impact->formatted_discount = core()->currency($impact->discount);
|
||||
|
||||
return $impact;
|
||||
}
|
||||
|
||||
|
||||
$impact->discount = $totalDiscount;
|
||||
$impact->formatted_discount = core()->currency($impact->discount);
|
||||
|
||||
return $impact;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,86 +2,23 @@
|
|||
|
||||
namespace Webkul\Discount\Actions\Cart;
|
||||
|
||||
use Webkul\Discount\Actions\Action;
|
||||
use Webkul\Discount\Actions\Cart\FixedAmount;
|
||||
|
||||
class WholeCartToFixed extends Action
|
||||
class WholeCartToFixed
|
||||
{
|
||||
/**
|
||||
* To calculate impact of cart rule's action of current items of cart instance
|
||||
*
|
||||
* @param CartRule $rule
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function calculate($rule)
|
||||
{
|
||||
$cart = \Cart::getCart();
|
||||
$items = $cart->items;
|
||||
$actualInstance = new FixedAmount();
|
||||
|
||||
$impact = collect();
|
||||
$result = $actualInstance->calculate($rule);
|
||||
|
||||
$impact->discount = $rule->disc_amount;
|
||||
$impact->formatted_discount = core()->currency($impact->discount);
|
||||
|
||||
if ($rule->uses_attribute_conditions) {
|
||||
$productIDs = $rule->product_ids;
|
||||
|
||||
$productIDs = explode(',', $productIDs);
|
||||
|
||||
$matchCount = 0;
|
||||
|
||||
foreach ($productIDs as $productID) {
|
||||
foreach ($items as $item) {
|
||||
if ($item->product_id == $productID) {
|
||||
$matchCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($productIDs as $productID) {
|
||||
foreach ($items as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
if ($item->product->type == 'configurable') {
|
||||
$itemProductId = $item->child->product_id;
|
||||
} else {
|
||||
$itemProductId = $item->product_id;
|
||||
}
|
||||
|
||||
$discount = round(($itemPrice * $impact->discount) / 100, 4);
|
||||
|
||||
if ($itemProductId == $productID) {
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['product_id'] = $item->product_id;
|
||||
$report['discount'] = $discount;
|
||||
$report['formatted_discount'] = core()->currency($discount);
|
||||
|
||||
$impact->push($report);
|
||||
|
||||
unset($report);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($items as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
if ($item->product->type == 'configurable') {
|
||||
$itemProductId = $item->child->product_id;
|
||||
} else {
|
||||
$itemProductId = $item->product_id;
|
||||
}
|
||||
|
||||
$discount = round(($itemPrice * $impact->discount) / 100, 4);
|
||||
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['product_id'] = $item->product_id;
|
||||
$report['discount'] = $discount;
|
||||
$report['formatted_discount'] = core()->currency($discount);
|
||||
|
||||
$impact->push($report);
|
||||
|
||||
unset($report);
|
||||
}
|
||||
}
|
||||
|
||||
return $impact;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,113 +2,23 @@
|
|||
|
||||
namespace Webkul\Discount\Actions\Cart;
|
||||
|
||||
use Webkul\Discount\Actions\Action;
|
||||
use Cart;
|
||||
use Webkul\Discount\Actions\Cart\PercentOfProduct;
|
||||
|
||||
class WholeCartToPercent extends Action
|
||||
class WholeCartToPercent
|
||||
{
|
||||
/**
|
||||
* To calculate impact of cart rule's action of current items of cart instance
|
||||
*
|
||||
* @param CartRule $rule
|
||||
* @param CartItem $items
|
||||
* @param Cart $cart
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function calculate($rule)
|
||||
{
|
||||
$cart = \Cart::getCart();
|
||||
$items = $cart->items;
|
||||
$actualInstance = new PercentOfProduct();
|
||||
|
||||
$impact = collect();
|
||||
$result = $actualInstance->calculate($rule);
|
||||
|
||||
$totalDiscount = 0;
|
||||
|
||||
if ($rule->uses_attribute_conditions) {
|
||||
$productIDs = $rule->product_ids;
|
||||
|
||||
$productIDs = explode(',', $productIDs);
|
||||
|
||||
$matchCount = 0;
|
||||
|
||||
foreach ($productIDs as $productID) {
|
||||
foreach ($items as $item) {
|
||||
if ($item->product_id == $productID) {
|
||||
$matchCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($matchCount > 0) {
|
||||
foreach ($productIDs as $productID) {
|
||||
foreach ($items as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
|
||||
|
||||
if ($discount >= $itemPrice) {
|
||||
$discount = $itemPrice;
|
||||
}
|
||||
|
||||
$totalDiscount = $totalDiscount + $discount;
|
||||
|
||||
if ($item->product_id == $productID) {
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
|
||||
|
||||
if ($discount <= $itemPrice) {
|
||||
$report['discount'] = $discount;
|
||||
} else {
|
||||
$report['discount'] = $itemPrice;
|
||||
}
|
||||
|
||||
$report['formatted_discount'] = core()->currency(round($discount, 4));
|
||||
|
||||
$impact->push($report);
|
||||
|
||||
unset($report);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($items as $item) {
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
|
||||
|
||||
if ($discount > $itemPrice) {
|
||||
$discount = $itemPrice;
|
||||
}
|
||||
|
||||
$totalDiscount = $totalDiscount + $discount;
|
||||
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
|
||||
|
||||
if ($discount <= $itemPrice) {
|
||||
$report['discount'] = $discount;
|
||||
} else {
|
||||
$report['discount'] = $itemPrice;
|
||||
}
|
||||
|
||||
$report['formatted_discount'] = core()->currency(round($discount, 4));
|
||||
|
||||
$impact->push($report);
|
||||
|
||||
unset($report);
|
||||
}
|
||||
}
|
||||
|
||||
$impact->discount = $totalDiscount;
|
||||
|
||||
$impact->fomatted_discount = core()->currency($impact->discount);
|
||||
|
||||
return $impact;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ return [
|
|||
'cart' => [
|
||||
'fixed_amount' => 'Webkul\Discount\Actions\Cart\FixedAmount',
|
||||
'percent_of_product' => 'Webkul\Discount\Actions\Cart\PercentOfProduct',
|
||||
// 'whole_cart_to_fixed' => 'aWebkul\Discount\Actions\Cart\WholeCartToFixed',
|
||||
'whole_cart_to_fixed' => 'Webkul\Discount\Actions\Cart\WholeCartToFixed',
|
||||
'whole_cart_to_percent' => 'Webkul\Discount\Actions\Cart\WholeCartToPercent'
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ return [
|
|||
'actions' => [
|
||||
'fixed_amount' => 'Apply as fixed amount',
|
||||
'percent_of_product' => 'Percentage of product',
|
||||
// 'whole_cart_to_fixed' => 'Adjust whole cart to fixed amount',
|
||||
'whole_cart_to_fixed' => 'Adjust whole cart to fixed amount',
|
||||
'whole_cart_to_percent' => 'Adjust whole cart to percent'
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ abstract class Discount
|
|||
|
||||
$this->updateCartItemAndCart($rule);
|
||||
|
||||
return;
|
||||
return $rule;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -171,34 +171,25 @@ class CartRuleController extends Controller
|
|||
// unset labels
|
||||
unset($data['label']);
|
||||
|
||||
// prepare json object from actions
|
||||
if (isset($data['disc_amount']) && $data['action_type'] == config('pricerules.cart.validations.2')) {
|
||||
$attribute_conditions = json_decode($attribute_conditions);
|
||||
|
||||
if (! isset($attribute_conditions) || $attribute_conditions == "[]" || $attribute_conditions == "" || ! (count($attribute_conditions->categories) && count($attribute_conditions->attributes))) {
|
||||
$data['uses_attribute_conditions'] = 0;
|
||||
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_threshold' => $data['disc_threshold']
|
||||
'disc_quantity' => $data['disc_quantity']
|
||||
];
|
||||
|
||||
$data['disc_quantity'] = $data['disc_amount'];
|
||||
} else {
|
||||
if (! isset($attribute_conditions) || $attribute_conditions == "[]" || $attribute_conditions == "") {
|
||||
$data['uses_attribute_conditions'] = 0;
|
||||
$data['uses_attribute_conditions'] = 1;
|
||||
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity']
|
||||
];
|
||||
} else {
|
||||
$data['uses_attribute_conditions'] = 1;
|
||||
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity'],
|
||||
'attribute_conditions' => $attribute_conditions
|
||||
];
|
||||
}
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity'],
|
||||
'attribute_conditions' => $attribute_conditions
|
||||
];
|
||||
}
|
||||
|
||||
// prepare json object from conditions
|
||||
|
|
@ -265,12 +256,11 @@ class CartRuleController extends Controller
|
|||
// $coupons['limit'] = $data['usage_limit'];
|
||||
// }
|
||||
|
||||
|
||||
// create a cart rule
|
||||
$ruleCreated = $this->cartRule->create($data);
|
||||
|
||||
// can execute convertX here after when the rule is updated
|
||||
if (isset($attribute_conditions) && $attribute_conditions != "[]" && $attribute_conditions != "") {
|
||||
if (isset($attribute_conditions) && $data['uses_attribute_conditions']) {
|
||||
$this->convertX->convertX($ruleCreated->id, $attribute_conditions);
|
||||
}
|
||||
|
||||
|
|
@ -407,34 +397,25 @@ class CartRuleController extends Controller
|
|||
unset($data['attributes']);
|
||||
|
||||
// prepare actions from data for json action
|
||||
if (isset($data['disc_amount']) && $data['action_type'] == config('pricerules.cart.validations.2')) {
|
||||
$attribute_conditions = json_decode($attribute_conditions);
|
||||
|
||||
if (! isset($attribute_conditions) || $attribute_conditions == "[]" || $attribute_conditions == "" || ! (count($attribute_conditions->categories) && count($attribute_conditions->attributes))) {
|
||||
$data['uses_attribute_conditions'] = 0;
|
||||
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity']
|
||||
];
|
||||
|
||||
$data['disc_quantity'] = $data['disc_amount'];
|
||||
} else {
|
||||
$attribute_conditions = json_decode($attribute_conditions);
|
||||
$data['uses_attribute_conditions'] = 1;
|
||||
|
||||
if (! (isset($attribute_conditions->categories) && count($attribute_conditions->categories)) && ! (isset($attribute_conditions->attributes) && count($attribute_conditions->attributes))) {
|
||||
$data['uses_attribute_conditions'] = 0;
|
||||
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity']
|
||||
];
|
||||
} else {
|
||||
$data['uses_attribute_conditions'] = 1;
|
||||
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity'],
|
||||
'attribute_conditions' => json_encode($attribute_conditions)
|
||||
];
|
||||
}
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity'],
|
||||
'attribute_conditions' => $attribute_conditions
|
||||
];
|
||||
}
|
||||
|
||||
// encode php array to json for actions
|
||||
|
|
|
|||
|
|
@ -411,8 +411,10 @@ class Bundle extends AbstractType
|
|||
|
||||
foreach ($optionProductIds as $optionProductId) {
|
||||
$optionProduct = $this->productBundleOptionProductRepository->find($optionProductId);
|
||||
|
||||
$qty = $data['bundle_option_qty'][$optionId] ?? $optionProduct->qty;
|
||||
|
||||
$labels[] = $optionProduct->product->name;
|
||||
$labels[] = $qty . ' x ' . $optionProduct->product->name . ' ' . core()->currency($optionProduct->product->getTypeInstance()->getMinimalPrice());
|
||||
}
|
||||
|
||||
$data['attributes'][$option->id] = [
|
||||
|
|
|
|||
|
|
@ -75,9 +75,8 @@ class Simple extends AbstractType
|
|||
->pluck('id');
|
||||
|
||||
foreach ($this->product->inventories as $inventory) {
|
||||
if (is_numeric($index = $channelInventorySourceIds->search($inventory->inventory_source_id))) {
|
||||
if (is_numeric($index = $channelInventorySourceIds->search($inventory->inventory_source_id)))
|
||||
$total += $inventory->qty;
|
||||
}
|
||||
}
|
||||
|
||||
$orderedInventory = $this->product->ordered_inventories()
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js?id=a1e2815cee337c8178a1",
|
||||
"/js/shop.js": "/js/shop.js?id=6383802913f7f9d6622a",
|
||||
"/css/shop.css": "/css/shop.css?id=5d9f7688d01d6d6abf8c"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ $(document).ready(function () {
|
|||
e.target.submit();
|
||||
} else {
|
||||
this.toggleButtonDisable(false);
|
||||
|
||||
eventBus.$emit('onFormError')
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { mix } = require("laravel-mix");
|
||||
const mix = require("laravel-mix");
|
||||
require("laravel-mix-merge-manifest");
|
||||
|
||||
if (mix.inProduction()) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=f13bdb357cc17de32acb",
|
||||
"/css/ui.css": "/css/ui.css?id=0a1175532cde112f7dd7"
|
||||
"/js/ui.js": "/js/ui.js?id=62a1f3ccf04e55a10ae8",
|
||||
"/css/ui.css": "/css/ui.css?id=6dea8035d339d689b46a"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
<template>
|
||||
<div class="accordian" :class="[isActive ? 'active' : '', className]" :id="id">
|
||||
<div class="accordian-header" @click="toggleAccordion()">
|
||||
<div class="accordian" :class="[isActive ? 'active' : '', className, ! isActive && hasError ? 'error' : '']" :id="id">
|
||||
<div class="accordian-header" @click="toggleAccordian()">
|
||||
<slot name="header">
|
||||
{{ title }}
|
||||
<i class="icon" :class="iconClass"></i>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
<div class="accordian-content">
|
||||
<slot name="body">
|
||||
</slot>
|
||||
<div class="accordian-content" ref="controls">
|
||||
<slot name="body"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -28,17 +27,29 @@
|
|||
data: function() {
|
||||
return {
|
||||
isActive: false,
|
||||
|
||||
imageData: '',
|
||||
|
||||
hasError: false
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
var this_this = this;
|
||||
|
||||
eventBus.$on('onFormError', function() {
|
||||
$(this_this.$el).find('.control-group').each(function(index, element) {
|
||||
if ($(element).hasClass('has-error'))
|
||||
this_this.hasError = true;
|
||||
});
|
||||
})
|
||||
|
||||
this.isActive = this.active;
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggleAccordion: function() {
|
||||
this.isActive = !this.isActive;
|
||||
toggleAccordian: function() {
|
||||
this.isActive = ! this.isActive;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -857,6 +857,12 @@ h5 {
|
|||
}
|
||||
}
|
||||
|
||||
&.error {
|
||||
.accordian-header {
|
||||
color: #ff5656;
|
||||
}
|
||||
}
|
||||
|
||||
.accordian-content, div[slot*="body"] {
|
||||
width: 100%;
|
||||
padding: 20px 15px;
|
||||
|
|
@ -976,6 +982,8 @@ modal {
|
|||
animation: fade-in-white 0.3s ease-in-out;
|
||||
animation: jelly 0.5s ease-in-out;
|
||||
@include border-radius(5px);
|
||||
overflow-y: scroll;
|
||||
max-height: 80%;
|
||||
|
||||
.modal-header {
|
||||
padding: 20px;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { mix } = require("laravel-mix");
|
||||
const mix = require("laravel-mix");
|
||||
require("laravel-mix-merge-manifest");
|
||||
|
||||
if (mix.inProduction()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue