khanegi setting and prices records

This commit is contained in:
2026-06-13 17:35:40 +03:30
parent c70cda0b6b
commit 91a82c06e4
15 changed files with 509 additions and 73 deletions
+13 -1
View File
@@ -18,7 +18,7 @@ class ProductDisplayPriceService
{
public const LIVE_PRICE_CACHE_KEY = 'live_price_api_payload';
public const LIVE_PRICE_CACHE_SECONDS = 45;
public const LIVE_PRICE_CACHE_SECONDS = 15;
public function usesAppPrice(Product $product): bool
{
@@ -262,6 +262,18 @@ class ProductDisplayPriceService
/** @param array<int, array<string, mixed>> $feed */
private function applyReferenceFeedPrice(Product $product, array $feed, ZaarboxPriceService $zaarbox): void
{
if (Product::hasStoredPriceColumns()) {
$stored = (int) ($product->price ?? 0) + (int) ($product->price_profit ?? 0);
if ($stored > 0) {
$product->setAttribute('price', (int) ($product->price ?? 0));
if (Schema::hasColumn($product->getTable(), 'price_profit')) {
$product->setAttribute('price_profit', (int) ($product->price_profit ?? 0));
}
return;
}
}
$row = $zaarbox->findFeedRow($feed, (string) $product->reading_method);
if ($row === null) {
$useLast = $this->productUsesLastPriceIfZero($product);