[IdealoBridge] Fix (#4316)

When a product was available before as used product in the past, and
now it's not available used anymore, a price update article was
generated on every feed loading, because the old used price was still
stored in the cache, and therefore different as "no price".

The issue was also present in the cas of a New product price that
becomes unavailable.

Now, when either there is no New or Used price available, the previous
price is delete from the cache.
This commit is contained in:
sysadminstory 2024-11-03 18:28:32 +01:00 committed by GitHub
parent 29d984cbe7
commit bd0fb1da99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -152,14 +152,21 @@ class IdealoBridge extends BridgeAbstract
$PriceNew = $FirstButton->find('strong', 0)->plaintext;
// Save current price
$this->saveCacheValue($KeyNEW, $PriceNew);
} else if ($FirstButton === null) {
// In case there is no actual New Price delete the previous value in the cache
$this->cache->delete($this->getShortName() . '_' . $KeyNEW);
}
// Second Button contains the used product price
$SecondButton = $html->find('.oopStage-conditionButton-wrapper-text', 1);
if ($SecondButton) {
$PriceUsed = $SecondButton->find('strong', 0)->plaintext;
// Save current price
$this->saveCacheValue($KeyUSED, $PriceUsed);
} else if ($SecondButton === null) {
// In case there is no actual Used Price delete the previous value in the cache
$this->cache->delete($this->getShortName() . '_' . $KeyUSED);
}
// Only continue if a price has changed