Rlvproduct.php 1.08 KB
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

namespace app\Models\parserSkripte;

use App\Models\Searchengine;

class RlvProduct extends Searchengine
{
    public $results = [];

    public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager)
    {
        parent::__construct($engine, $metager);
    }

    public function loadResults($result)
    {
        # try
        # {
        $results = json_decode($result, true);
        $counter = 0;
        foreach ($results["products"] as $result) {
            $counter++;
            $image            = $result["productImage"];
            $image            = str_replace("//", "https://", $image);
            $this->products[] = new \App\Models\Result(
                $this->engine,
                $result["productTitle"],
                $result["shopLink"],
                $result["shopLink"],
                "",
                $result["shopTitle"],
                $counter,
                $partnershop = false,
                $image,
Dominik Hebeler's avatar
Dominik Hebeler committed
36
37
                $result["price"],
                ['shipping' => $result["distribution"]]
Dominik Hebeler's avatar
Dominik Hebeler committed
38
39
40
41
            );
        }
    }
}