aboutsummaryrefslogtreecommitdiff
path: root/bridges/IdealoBridge.php
diff options
context:
space:
mode:
authorGravatar Anshul Gupta <ansg191@anshulg.com> 2025-03-02 19:32:33 -0800
committerGravatar GitHub <noreply@github.com> 2025-03-02 19:32:33 -0800
commit8b16dd20f6544af3eedf286e23c0d34ab525736c (patch)
treeec284e22a046c4c8e9626e3fa64a000a2747bf84 /bridges/IdealoBridge.php
parentb183aa798af48af556496c42780d6e844172cf44 (diff)
parent00a24e2f694a319a5e6cb070dddfff2dae892378 (diff)
downloadrss-bridge-master.tar.gz
rss-bridge-master.tar.zst
rss-bridge-master.zip
Merge branch 'RSS-Bridge:master' into masterHEADmaster
Diffstat (limited to 'bridges/IdealoBridge.php')
-rw-r--r--bridges/IdealoBridge.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/bridges/IdealoBridge.php b/bridges/IdealoBridge.php
index 92bb30d0..55cee467 100644
--- a/bridges/IdealoBridge.php
+++ b/bridges/IdealoBridge.php
@@ -150,29 +150,34 @@ class IdealoBridge extends BridgeAbstract
$ActualNewPrice = $html->find('div[id=oopStage-conditionButton-new]', 0);
// Second Button contains the used product price
$ActualUsedPrice = $html->find('div[id=oopStage-conditionButton-used]', 0);
+ // Get the first item of the offers list to have an option if there is no New/Used Button available
+ $altPrice = $html->find('.productOffers-listItemOfferPrice', 0);
if ($ActualNewPrice) {
$PriceNew = $ActualNewPrice->find('strong', 0)->plaintext;
// Save current price
$this->saveCacheValue($KeyNEW, $PriceNew);
- } else if ($ActualNewPrice === null && $ActualUsedPrice !== null) {
- // In case there is no actual New Price and a Ured Price exists, then delete the previous value in the cache
- $this->cache->delete($this->getShortName() . '_' . $KeyNEW);
+ } else if ($altPrice) {
+ // Get price from first List item if no New/used Buttons available
+ $PriceNew = trim($altPrice->plaintext);
+ $this->saveCacheValue($KeyNEW, $PriceNew);
+ } else if (($ActualNewPrice === null || $altPrice === null) && $ActualUsedPrice !== null) {
+ // In case there is no actual New Price and a Used Price exists, then delete the previous value in the cache
+ $this->cache->delete($this->getShortName() . '_' . $KeyNEW);
}
-
// Second Button contains the used product price
if ($ActualUsedPrice) {
$PriceUsed = $ActualUsedPrice->find('strong', 0)->plaintext;
// Save current price
$this->saveCacheValue($KeyUSED, $PriceUsed);
- } else if ($ActualUsedPrice === null && $ActualNewPrice !== null) {
+ } else if ($ActualUsedPrice === null && ($ActualNewPrice !== null || $altPrice !== null)) {
// In case there is no actual Used Price and a New Price exists, then delete the previous value in the cache
- $this->cache->delete($this->getShortName() . '_' . $KeyUSED);
+ $this->cache->delete($this->getShortName() . '_' . $KeyUSED);
}
- // Only continue if a price has changed and there exists a New or Used price (sometimes no new Price _and_ Used Price are shown)
- if (!($ActualNewPrice === null && $ActualUsedPrice === null ) && ($PriceNew != $OldPriceNew || $PriceUsed != $OldPriceUsed)) {
+ // Only continue if a price has changed and there exists a New, Used or Alternative price (sometimes no new Price _and_ Used Price are shown)
+ if (!($ActualNewPrice === null && $ActualUsedPrice === null && $altPrice === null) && ($PriceNew != $OldPriceNew || $PriceUsed != $OldPriceUsed)) {
// Get Product Image
$image = $html->find('.datasheet-cover-image', 0)->src;