fix bug
This commit is contained in:
@@ -207,9 +207,7 @@ class ProductController extends SuperController
|
||||
$displayPriceService->warmLivePriceCache();
|
||||
$displayPriceService->enrichForApi($products);
|
||||
$products->each(function (Product $product) use ($displayPriceService) {
|
||||
if (! $displayPriceService->hasCustomerDisplayPrice($product)) {
|
||||
$product->setAttribute('show', false);
|
||||
}
|
||||
$product->setAttribute('show', $displayPriceService->resolveCustomerShow($product));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -257,12 +255,11 @@ class ProductController extends SuperController
|
||||
|
||||
public function auto_close_open()
|
||||
{
|
||||
$config = app(ConfigService::class);
|
||||
$products = Product::with([])->get();
|
||||
$current_time = now()->format('H:i:s');
|
||||
foreach ($products as $product) {
|
||||
$show = ($current_time >= $product->auto_open_at && $current_time <= $product->auto_close_at);
|
||||
Product::where('id', $product->id)->update([
|
||||
'show' => $show,
|
||||
'show' => $config->isProductWithinTradingHours($product),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -358,13 +355,17 @@ class ProductController extends SuperController
|
||||
|
||||
}
|
||||
|
||||
/** فروشگاه — نمایش در اپ کاربر: فعال + قیمت ذخیرهشده یا محصول وزنی */
|
||||
/** فروشگاه — نمایش در اپ کاربر: فعال + ساعات + قیمت ذخیرهشده یا محصول وزنی */
|
||||
private function storeProductShowForCustomer(Product $product): bool
|
||||
{
|
||||
if (! $product->active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! app(ConfigService::class)->isProductWithinTradingHours($product)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$storedPrice = (int) ($product->price ?? 0) + (int) ($product->price_profit ?? 0);
|
||||
if ($storedPrice > 0) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user