fix amount 5
This commit is contained in:
@@ -92,7 +92,12 @@ class ProductController extends SuperController
|
||||
// return 1;
|
||||
|
||||
$data = $this->filterProductData($request->all());
|
||||
if (isset($data["price"])){
|
||||
$clearingReadingMethod = array_key_exists('reading_method', $data)
|
||||
&& ($data['reading_method'] === null || $data['reading_method'] === '');
|
||||
if ($clearingReadingMethod) {
|
||||
$data['reading_method'] = null;
|
||||
}
|
||||
if (isset($data["price"])) {
|
||||
$data["reading_method"] = null;
|
||||
if (Product::hasPriceOffsetColumn()) {
|
||||
$data['price_offset_percent'] = 0;
|
||||
@@ -121,6 +126,7 @@ class ProductController extends SuperController
|
||||
Product::hasPriceOffsetColumn()
|
||||
&& $product->reading_method
|
||||
&& array_key_exists('price_offset_percent', $data)
|
||||
&& !$clearingReadingMethod
|
||||
) {
|
||||
ProductPriceService::reapplyOffsetPercent(
|
||||
$product,
|
||||
@@ -150,7 +156,11 @@ class ProductController extends SuperController
|
||||
$products = Product::with(['file'])->where('active', 1)->get();
|
||||
|
||||
if (Product::hasPriceOffsetColumn() && str_contains(request()->path(), '/customer/')) {
|
||||
$products->each->makeHidden(['price_offset_percent']);
|
||||
$products->each(function (Product $product) {
|
||||
if ($product->reading_method) {
|
||||
$product->makeHidden(['price_offset_percent']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return response()->json($products);
|
||||
|
||||
Reference in New Issue
Block a user