mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-24 11:51:12 +01:00
Merge pull request #105 from exciler/prestashop-import-keywords
Prestashop: import keywords and small bugfixes
This commit is contained in:
commit
6df9ba2d00
@ -23,6 +23,7 @@ class Shopimporter_Presta extends ShopimporterBase
|
|||||||
// TODO
|
// TODO
|
||||||
private $langidToIso = [3 => 'de', 1 => 'en'];
|
private $langidToIso = [3 => 'de', 1 => 'en'];
|
||||||
private $taxationByDestinationCountry;
|
private $taxationByDestinationCountry;
|
||||||
|
private $orderSearchLimit;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($app, $intern = false)
|
public function __construct($app, $intern = false)
|
||||||
@ -284,17 +285,20 @@ class Shopimporter_Presta extends ShopimporterBase
|
|||||||
|
|
||||||
$cart['articlelist'] = [];
|
$cart['articlelist'] = [];
|
||||||
foreach ($order->associations->order_rows->order_row as $order_row) {
|
foreach ($order->associations->order_rows->order_row as $order_row) {
|
||||||
|
$article = [
|
||||||
$steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1;
|
|
||||||
$steuersatz = round($steuersatz, 1);
|
|
||||||
|
|
||||||
$cart['articlelist'][] = [
|
|
||||||
'articleid' => strval($order_row->product_reference),
|
'articleid' => strval($order_row->product_reference),
|
||||||
'name' => strval($order_row->product_name),
|
'name' => strval($order_row->product_name),
|
||||||
'quantity' => strval($order_row->product_quantity),
|
'quantity' => strval($order_row->product_quantity),
|
||||||
'price_netto' => strval($order_row->unit_price_tax_excl),
|
'price_netto' => strval($order_row->unit_price_tax_excl),
|
||||||
'steuersatz' => $steuersatz
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($order_row->unit_price_tax_excl > 0) {
|
||||||
|
$steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1;
|
||||||
|
$steuersatz = round($steuersatz, 1);
|
||||||
|
$article['steuersatz'] = $steuersatz;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cart['articlelist'][] = $article;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fetchedOrders[] = [
|
$fetchedOrders[] = [
|
||||||
@ -381,13 +385,26 @@ class Shopimporter_Presta extends ShopimporterBase
|
|||||||
$res['kurztext_de'] = strip_tags($shortdescriptions['de']);
|
$res['kurztext_de'] = strip_tags($shortdescriptions['de']);
|
||||||
$res['kurztext_en'] = strip_tags($shortdescriptions['en']);
|
$res['kurztext_en'] = strip_tags($shortdescriptions['en']);
|
||||||
$res['hersteller'] = strval($product->product->manufacturer_name);
|
$res['hersteller'] = strval($product->product->manufacturer_name);
|
||||||
$res['metakeywords_de'] = $metakeywords['de'];
|
|
||||||
$res['metakeywords_en'] = $metakeywords['en'];
|
|
||||||
$res['metatitle_de'] = $metatitles['de'];
|
$res['metatitle_de'] = $metatitles['de'];
|
||||||
$res['metatitle_en'] = $metatitles['en'];
|
$res['metatitle_en'] = $metatitles['en'];
|
||||||
$res['metadescription_de'] = $metadescriptions['de'];
|
$res['metadescription_de'] = $metadescriptions['de'];
|
||||||
$res['metadescription_en'] = $metadescriptions['en'];
|
$res['metadescription_en'] = $metadescriptions['en'];
|
||||||
|
|
||||||
|
$tags = $product->product->associations->tags->tag;
|
||||||
|
$keywords = [];
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
$tagid = intval($tag->id);
|
||||||
|
$endpoint = "tags/{$tagid}";
|
||||||
|
$tagdata = $this->prestaRequest('GET', $endpoint);
|
||||||
|
$tagiso = $this->langidToIso[intval($tagdata->tag->id_lang)];
|
||||||
|
$tagvalue = strval($tagdata->tag->name);
|
||||||
|
if (!array_key_exists($tagiso, $keywords))
|
||||||
|
$keywords[$tagiso] = [];
|
||||||
|
$keywords[$tagiso][] = $tagvalue;
|
||||||
|
}
|
||||||
|
$res['metakeywords_de'] = join(',', $keywords['de'] ?? []);
|
||||||
|
$res['metakeywords_en'] = join(',', $keywords['en'] ?? []);
|
||||||
|
|
||||||
$images = [];
|
$images = [];
|
||||||
foreach ($product->product->associations->images->image as $img) {
|
foreach ($product->product->associations->images->image as $img) {
|
||||||
$endpoint = "images/products/$productId/$img->id";
|
$endpoint = "images/products/$productId/$img->id";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user