Skip to content
GitLab
Menu
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
f10a307a
Commit
f10a307a
authored
Apr 24, 2019
by
Aria Givi
Browse files
Results properly displayed, getNext not implemented yet
parent
85f06418
Changes
2
Show whitespace changes
Inline
Side-by-side
app/Models/parserSkripte/Kelkoo.php
View file @
f10a307a
...
...
@@ -20,23 +20,42 @@ class Kelkoo extends Searchengine
public
function
loadResults
(
$result
)
{
$result
=
preg_replace
(
"/
\r\n
/si"
,
""
,
$result
);
# delete namespace, allowing easier xpath access
$result
=
str_replace
(
'xmlns="urn:yahoo:prods"'
,
''
,
$result
);
try
{
$content
=
simplexml_load_string
(
$result
);
if
(
!
$content
)
{
return
;
}
$results
=
$content
->
xpath
(
'//response/result[@name="response"]/doc'
);
# Kekloo gives us the total Result Count
$resultCount
=
$content
->
xpath
(
'/ProductSearch/Products/@totalResultsAvailable'
);
if
(
sizeof
(
$resultCount
)
>
0
)
{
$resultCount
=
intval
(
$resultCount
[
0
]
->
__toString
());
}
else
{
$resultCount
=
0
;
}
$this
->
totalResults
=
$resultCount
;
$results
=
$content
->
xpath
(
'/ProductSearch/Products/Product/Offer'
);
foreach
(
$results
as
$result
)
{
$result
=
simplexml_load_string
(
$result
->
saveXML
());
$title
=
$result
->
xpath
(
'/doc/arr[@name="artikelName"]'
)[
0
]
->
{
"str"
}
->
__toString
();
$link
=
$result
->
xpath
(
'/doc/arr[@name="artikelDeeplink"]'
)[
0
]
->
{
"str"
}
->
__toString
();
$anzeigeLink
=
parse_url
(
$link
);
parse_str
(
$anzeigeLink
[
'query'
],
$query
);
$anzeigeLink
=
$query
[
'url'
];
$descr
=
$result
->
xpath
(
'/doc/arr[@name="artikelBeschreibung"]'
)[
0
]
->
{
"str"
}
->
__toString
();
$image
=
$result
->
xpath
(
'/doc/arr[@name="artikelImageurl"]'
)[
0
]
->
{
"str"
}
->
__toString
();
$title
=
$result
->
Title
[
0
]
->
__toString
();
$price
=
floatval
(
$result
->
Price
[
0
]
->
Price
[
0
]);
$deliveryPrice
=
floatval
(
$result
->
Price
[
0
]
->
DeliveryCost
[
0
]);
$totalPrice
=
$price
+
$deliveryPrice
;
$descr
=
""
;
if
(
isset
(
$result
->
Description
[
0
]))
{
$descr
=
$result
->
Description
[
0
]
->
__toString
();
}
$descr
.
=
"<p>Preis: "
.
$price
.
" €</p>"
;
$image
=
$result
->
Images
[
0
]
->
Image
[
0
]
->
Url
[
0
]
->
__toString
();
$link
=
$result
->
Url
[
0
]
->
__toString
();
$anzeigeLink
=
$result
->
Merchant
[
0
]
->
Name
[
0
]
->
__toString
();
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
$this
->
engine
,
...
...
@@ -46,7 +65,8 @@ class Kelkoo extends Searchengine
$descr
,
$this
->
engine
->
{
"display-name"
},
$this
->
engine
->
homepage
,
$this
->
counter
,
[
'image'
=>
$image
]
[
'image'
=>
$image
,
'price'
=>
$totalPrice
*
100
]
);
}
}
catch
(
\
Exception
$e
)
{
...
...
@@ -56,6 +76,10 @@ class Kelkoo extends Searchengine
}
}
public
function
getNext
(
\
App\MetaGer
$metager
,
$result
)
{
}
# kelkoogroup.com/kelkoo-customer-service/kelkoo-developer-network/shopping-services/samples/signing-url-php/
private
function
UrlSigner
(){
...
...
sumas_backup.json
0 → 100644
View file @
f10a307a
"produkte"
:
{
"display-name"
:
"index.foki.produkte"
,
"sumas"
:
[
"ebay"
,
"mg_produkt"
,
"mg_produkt2"
,
"ecoshopper"
,
"similar_product"
,
"fairmondo"
,
"shopzilla"
,
"kelkoo"
],
"main"
:
[
"ebay"
,
"fairmondo"
,
"yahoo-ads"
,
"kelkoo"
]
}
,
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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