mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-26 04:31:14 +01:00
mirakl Zwischenstand
This commit is contained in:
parent
9d547c6e52
commit
9d71d9812f
@ -1111,7 +1111,7 @@ if (typeof document.hidden !== \"undefined\") { // Opera 12.10 and Firefox 18 an
|
|||||||
}
|
}
|
||||||
|
|
||||||
// userd edit ajax call
|
// userd edit ajax call
|
||||||
$poll = true;
|
// $poll = true;
|
||||||
if($poll) {
|
if($poll) {
|
||||||
$this->addPollJs($module, $action, $id);
|
$this->addPollJs($module, $action, $id);
|
||||||
}
|
}
|
||||||
|
@ -3339,7 +3339,7 @@ INNER JOIN shopexport s ON
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($this->app->Secure->GetPOST('pruefen')) {
|
if($this->app->Secure->GetPOST('pruefen')) {
|
||||||
|
|
||||||
$className = 'Remote';
|
$className = 'Remote';
|
||||||
$methodName = 'RemoteConnection';
|
$methodName = 'RemoteConnection';
|
||||||
$r = new ReflectionMethod($className, $methodName);
|
$r = new ReflectionMethod($className, $methodName);
|
||||||
|
@ -45,14 +45,14 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Protokollierung im Logfile|}:'
|
'bezeichnung' => '{|Protokollierung im Logfile|}:'
|
||||||
],
|
],
|
||||||
'textekuerzen' => [
|
/* 'textekuerzen' => [
|
||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Texte bei Artikelexport auf Maximallänge kürzen|}:'
|
'bezeichnung' => '{|Texte bei Artikelexport auf Maximallänge kürzen|}:'
|
||||||
],
|
],
|
||||||
'useKeyAsParameter' => [
|
'useKeyAsParameter' => [
|
||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Shop Version ist mindestens 1.6.1.1|}:'
|
'bezeichnung' => '{|Shop Version ist mindestens 1.6.1.1|}:'
|
||||||
],
|
],*/
|
||||||
'apikey' => [
|
'apikey' => [
|
||||||
'typ' => 'text',
|
'typ' => 'text',
|
||||||
'bezeichnung' => '{|API Key|}:',
|
'bezeichnung' => '{|API Key|}:',
|
||||||
@ -65,9 +65,9 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
],
|
],
|
||||||
'shopidmirakl' => [
|
'shopidmirakl' => [
|
||||||
'typ' => 'text',
|
'typ' => 'text',
|
||||||
'bezeichnung' => '{|Shop ID des Shops|}:',
|
'bezeichnung' => '{|Shop ID des Shops (optional, int64)|}:',
|
||||||
'size' => 40,
|
'size' => 40,
|
||||||
],
|
],/*
|
||||||
'steuergruppen' => [
|
'steuergruppen' => [
|
||||||
'typ' => 'text',
|
'typ' => 'text',
|
||||||
'bezeichnung' => '{|Steuergruppenmapping|}:',
|
'bezeichnung' => '{|Steuergruppenmapping|}:',
|
||||||
@ -107,7 +107,7 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Artikelpreis im Shop anzeigen|}:',
|
'bezeichnung' => '{|Artikelpreis im Shop anzeigen|}:',
|
||||||
'col' => 2
|
'col' => 2
|
||||||
],
|
],*/
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -136,15 +136,39 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
$this->taxationByDestinationCountry = !empty($this->app->DB->Select($query));
|
$this->taxationByDestinationCountry = !empty($this->app->DB->Select($query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function miraklRequest(string $endpoint, array $postdata = null, bool $raw = false)
|
||||||
|
{
|
||||||
|
$ch = curl_init($this->shopUrl.$endpoint);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: ".$this->apiKey));
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
if (!empty($postdata)) {
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
if (curl_error($ch)) {
|
||||||
|
$this->error[] = curl_error($ch);
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($raw)
|
||||||
|
return $response;
|
||||||
|
|
||||||
|
return simplexml_load_string($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function ImportAuth() {
|
public function ImportAuth() {
|
||||||
$ch = curl_init($this->shopUrl);
|
$ch = curl_init($this->shopUrl."version");
|
||||||
curl_setopt($ch, CURLOPT_USERNAME, $this->apiKey);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: ".$this->apiKey));
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
||||||
if ($code == 200)
|
if ($code == 200) {
|
||||||
return 'success';
|
return 'success '.print_r($response,true);
|
||||||
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +341,11 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
public function ImportGetArticleList()
|
public function ImportGetArticleList()
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
$response = $this->miraklRequest('GET', 'products?display=[reference]');
|
$response = $this->miraklRequest('offers');
|
||||||
|
|
||||||
|
print_r($response);
|
||||||
|
exit();
|
||||||
|
|
||||||
foreach ($response->products->product as $product) {
|
foreach ($response->products->product as $product) {
|
||||||
$result[] = $product->reference;
|
$result[] = $product->reference;
|
||||||
}
|
}
|
||||||
@ -454,30 +482,5 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
$this->app->erp->Logfile($message, print_r($dump, true));
|
$this->app->erp->Logfile($message, print_r($dump, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function miraklRequest($method, $endpoint, $data = '', $raw = false)
|
|
||||||
{
|
|
||||||
$url = $this->shopUrl . $endpoint;
|
|
||||||
$url = str_replace('[', '%5b', $url);
|
|
||||||
$url = str_replace(']', '%5d', $url);
|
|
||||||
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
if (!empty($data)) {
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
||||||
}
|
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
|
||||||
curl_setopt($ch, CURLOPT_USERNAME, $this->apiKey);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
$response = curl_exec($ch);
|
|
||||||
if (curl_error($ch)) {
|
|
||||||
$this->error[] = curl_error($ch);
|
|
||||||
}
|
|
||||||
curl_close($ch);
|
|
||||||
|
|
||||||
if ($raw)
|
|
||||||
return $response;
|
|
||||||
|
|
||||||
return simplexml_load_string($response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
<div class="inside inside-full-height">
|
<div class="inside inside-full-height">
|
||||||
<fieldset><legend>{|Aktion|}</legend>
|
<fieldset><legend>{|Aktion|}</legend>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td><input type="button" onclick="verpruefen();" value="{|Verbindung prüfen|}" class="aktionbutton" ></td></tr>
|
<tr><td><input type="submit" form="frmpruefen" value="{|Verbindung prüfen|}" class="aktionbutton" ></td></tr>
|
||||||
<tr><td width="50%"><input type="button" onclick="Holeauftrag();" value="{|Aufträge abholen|}" class="aktionbutton" ></td></tr>
|
<tr><td width="50%"><input type="button" onclick="Holeauftrag();" value="{|Aufträge abholen|}" class="aktionbutton" ></td></tr>
|
||||||
[AKTIONBUTTONS]
|
[AKTIONBUTTONS]
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user