Add new settings and cache repository files, update admin settings controller and templates

- Introduced new `SettingsRepository` and `CacheRepository` classes in the `autoload\Domain` namespace.
- Updated `SettingsController` in the `admin\Controllers` namespace to enhance settings management.
- Added new templates for settings in `admin\templates\settings` and `admin\templates\site`.
- Improved overall structure and organization of settings-related files.
This commit is contained in:
2026-02-05 23:32:48 +01:00
parent 3a7be21432
commit 1c88f8adfa
35 changed files with 1233 additions and 87 deletions

View File

@@ -50,6 +50,41 @@ class ProductRepository
return $product ?: null;
}
/**
* Pobiera cenę produktu (promocyjną jeśli jest niższa, w przeciwnym razie regularną)
*
* @param int $productId ID produktu
* @return float|null Cena brutto lub null jeśli nie znaleziono
*/
public function getPrice(int $productId): ?float
{
$prices = $this->db->get('pp_shop_products', ['price_brutto', 'price_brutto_promo'], ['id' => $productId]);
if (!$prices) {
return null;
}
if ($prices['price_brutto_promo'] != '' && $prices['price_brutto_promo'] < $prices['price_brutto']) {
return (float)$prices['price_brutto_promo'];
}
return (float)$prices['price_brutto'];
}
/**
* Pobiera nazwę produktu w danym języku
*
* @param int $productId ID produktu
* @param string $langId ID języka
* @return string|null Nazwa produktu lub null jeśli nie znaleziono
*/
public function getName(int $productId, string $langId): ?string
{
$name = $this->db->get('pp_shop_products_langs', 'name', ['AND' => ['product_id' => $productId, 'lang_id' => $langId]]);
return $name ?: null;
}
/**
* Aktualizuje ilość produktu
*