Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
3df608ce
Commit
3df608ce
authored
Nov 29, 2021
by
Dominik Hebeler
Browse files
fix error in fairmondo query
parent
09370ef5
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Models/parserSkripte/Fairmondo.php
View file @
3df608ce
...
...
@@ -15,39 +15,52 @@ class Fairmondo extends Searchengine
public
function
loadResults
(
$result
)
{
$results
=
json_decode
(
$result
,
true
);
$results
=
$results
[
"articles"
];
foreach
(
$results
as
$result
)
{
if
(
$this
->
counter
>=
10
)
{
break
;
}
try
{
$results
=
json_decode
(
$result
,
true
);
$title
=
$result
[
"title"
];
$link
=
"https://www.fairmondo.de/articles/"
.
$result
[
"id"
];
$anzeigeLink
=
$link
;
$price
=
0
;
$descr
=
""
;
if
(
isset
(
$result
[
'price_cents'
]))
{
$price
=
intval
(
$result
[
'price_cents'
]);
$descr
.
=
"<p>Preis: "
.
(
intval
(
$result
[
'price_cents'
])
/
100.0
)
.
" €</p>"
;
}
if
(
isset
(
$result
[
'title_image_url'
]))
{
$image
=
$result
[
'title_image_url'
];
if
(
empty
(
$results
))
{
return
;
}
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
$this
->
engine
,
$title
,
$link
,
$anzeigeLink
,
$descr
,
$this
->
engine
->
{
"display-name"
},
$this
->
engine
->
homepage
,
$this
->
counter
,
[
'price'
=>
$price
,
'image'
=>
$image
]
);
$results
=
$results
[
"articles"
];
foreach
(
$results
as
$result
)
{
if
(
$this
->
counter
>=
10
)
{
break
;
}
$title
=
$result
[
"title"
];
$link
=
"https://www.fairmondo.de/articles/"
.
$result
[
"id"
];
$anzeigeLink
=
$link
;
$price
=
0
;
$descr
=
""
;
if
(
isset
(
$result
[
'price_cents'
]))
{
$price
=
intval
(
$result
[
'price_cents'
]);
$descr
.
=
"<p>Preis: "
.
(
intval
(
$result
[
'price_cents'
])
/
100.0
)
.
" €</p>"
;
}
if
(
isset
(
$result
[
'title_image_url'
]))
{
$image
=
$result
[
'title_image_url'
];
}
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
$this
->
engine
,
$title
,
$link
,
$anzeigeLink
,
$descr
,
$this
->
engine
->
{
"display-name"
},
$this
->
engine
->
homepage
,
$this
->
counter
,
[
'price'
=>
$price
,
'image'
=>
$image
]
);
}
}
catch
(
\
Exception
$e
)
{
Log
::
error
(
"A problem occurred parsing results from
$this->name
:"
);
Log
::
error
(
$e
->
getMessage
());
return
;
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment