diff --git a/src/QUI/ERP/Products/Product/Model.php b/src/QUI/ERP/Products/Product/Model.php index 2ac678fb28e82aaa09061d4693a248412f1ffd83..dbde17b32ef3dfec4ddf9cf139888958f4712e0e 100644 --- a/src/QUI/ERP/Products/Product/Model.php +++ b/src/QUI/ERP/Products/Product/Model.php @@ -403,6 +403,7 @@ public function createUniqueProduct(null | User $User = null): UniqueProduct $fieldList = $this->getFields(); $attributes = null; + $cacheName = false; if (Products::$useRuntimeCacheForUniqueProducts) { $cacheName = self::getUniqueProductCachePath($User); @@ -452,7 +453,7 @@ public function createUniqueProduct(null | User $User = null): UniqueProduct } - if (Products::$useRuntimeCacheForUniqueProducts && isset($cacheName)) { + if (Products::$useRuntimeCacheForUniqueProducts && $cacheName) { ProductCache::writeUniqueProductData($attributes, $cacheName); } diff --git a/src/QUI/ERP/Products/Utils/Products.php b/src/QUI/ERP/Products/Utils/Products.php index 12d9250e414bfb1ce395fb60ad6b8834036d28b1..5de8e3a0300a2c6f402fe66aa7fe6049c969432c 100644 --- a/src/QUI/ERP/Products/Utils/Products.php +++ b/src/QUI/ERP/Products/Utils/Products.php @@ -190,7 +190,11 @@ public static function getPriceFieldForProduct( if (is_null($priceValue) || $value < $priceValue) { $priceValue = $value; - $currencyPrices = $PriceField->getOption('currencies'); + $currencyPrices = []; + + if (method_exists($PriceField, 'getOption')) { + $currencyPrices = $PriceField->getOption('currencies'); + } if (!empty($currencyPrices[$Currency->getCode()])) { $priceValue = $currencyPrices[$Currency->getCode()]; @@ -203,7 +207,7 @@ public static function getPriceFieldForProduct( $priceValue = $priceValue->getValue(); } - return new QUI\ERP\Money\Price($priceValue, $Currency, null, $currencyPrices); + return new QUI\ERP\Money\Price($priceValue, $Currency); } /**