mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-16 06:29:36 +00:00
Added ability to get GTINs for reichelt and Generic WebURL
This commit is contained in:
parent
fd76ca12fc
commit
1130f71075
3 changed files with 28 additions and 10 deletions
|
|
@ -227,10 +227,11 @@ class GenericWebProvider implements InfoProviderInterface
|
|||
mpn: $product->mpn?->toString(),
|
||||
preview_image_url: $image,
|
||||
provider_url: $url,
|
||||
gtin: $product->gtin14?->toString() ?? $product->gtin13?->toString() ?? $product->gtin12?->toString() ?? $product->gtin8?->toString(),
|
||||
notes: $notes,
|
||||
parameters: $parameters,
|
||||
vendor_infos: $vendor_infos,
|
||||
mass: $mass
|
||||
mass: $mass,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -429,7 +430,8 @@ class GenericWebProvider implements InfoProviderInterface
|
|||
return [
|
||||
ProviderCapabilities::BASIC,
|
||||
ProviderCapabilities::PICTURE,
|
||||
ProviderCapabilities::PRICE
|
||||
ProviderCapabilities::PRICE,
|
||||
ProviderCapabilities::GTIN,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ class ReicheltProvider implements InfoProviderInterface
|
|||
$name = $element->filter('meta[itemprop="name"]')->attr('content');
|
||||
$sku = $element->filter('meta[itemprop="sku"]')->attr('content');
|
||||
|
||||
|
||||
|
||||
//Try to extract a picture URL:
|
||||
$pictureURL = $element->filter("div.al_artlogo img")->attr('src');
|
||||
|
||||
|
|
@ -95,7 +97,8 @@ class ReicheltProvider implements InfoProviderInterface
|
|||
category: null,
|
||||
manufacturer: $sku,
|
||||
preview_image_url: $pictureURL,
|
||||
provider_url: $element->filter('a.al_artinfo_link')->attr('href')
|
||||
provider_url: $element->filter('a.al_artinfo_link')->attr('href'),
|
||||
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -146,6 +149,14 @@ class ReicheltProvider implements InfoProviderInterface
|
|||
$priceString = $dom->filter('meta[itemprop="price"]')->attr('content');
|
||||
$currency = $dom->filter('meta[itemprop="priceCurrency"]')->attr('content', 'EUR');
|
||||
|
||||
foreach (['gtin13', 'gtin14', 'gtin12', 'gtin8'] as $gtinType) {
|
||||
if ($dom->filter("[itemprop=\"$gtinType\"]")->count() > 0) {
|
||||
$gtin = $dom->filter("[itemprop=\"$gtinType\"]")->innerText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Create purchase info
|
||||
$purchaseInfo = new PurchaseInfoDTO(
|
||||
distributor_name: self::DISTRIBUTOR_NAME,
|
||||
|
|
@ -167,10 +178,11 @@ class ReicheltProvider implements InfoProviderInterface
|
|||
mpn: $this->parseMPN($dom),
|
||||
preview_image_url: $json[0]['article_picture'],
|
||||
provider_url: $productPage,
|
||||
gtin: $gtin,
|
||||
notes: $notes,
|
||||
datasheets: $datasheets,
|
||||
parameters: $this->parseParameters($dom),
|
||||
vendor_infos: [$purchaseInfo]
|
||||
vendor_infos: [$purchaseInfo],
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -273,6 +285,7 @@ class ReicheltProvider implements InfoProviderInterface
|
|||
ProviderCapabilities::PICTURE,
|
||||
ProviderCapabilities::DATASHEET,
|
||||
ProviderCapabilities::PRICE,
|
||||
ProviderCapabilities::GTIN,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue