mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Retrieve category info from LCSC
This commit is contained in:
parent
e937432d1e
commit
4b7d200aa2
1 changed files with 13 additions and 0 deletions
|
@ -151,11 +151,24 @@ class LCSCProvider implements InfoProviderInterface
|
|||
$footprint = strip_tags($footprint);
|
||||
}
|
||||
|
||||
//Build category by concatenating the catalogName and parentCatalogName
|
||||
$category = null;
|
||||
if (isset($product['parentCatalogName'])) {
|
||||
$category = $product['parentCatalogName'];
|
||||
}
|
||||
if (isset($product['catalogName'])) {
|
||||
$category = ($category ?? '') . ' -> ' . $product['catalogName'];
|
||||
|
||||
// Replace the / with a -> for better readability
|
||||
$category = str_replace('/', ' -> ', $category);
|
||||
}
|
||||
|
||||
return new PartDetailDTO(
|
||||
provider_key: $this->getProviderKey(),
|
||||
provider_id: $product['productCode'],
|
||||
name: $product['productModel'],
|
||||
description: strip_tags($product['productIntroEn']),
|
||||
category: $category,
|
||||
manufacturer: $product['brandNameEn'],
|
||||
mpn: $product['productModel'] ?? null,
|
||||
preview_image_url: $product['productImageUrl'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue