Use MPN instead of part name for auto product URLs if available

Implements issue #93
This commit is contained in:
Jan Böhmer 2023-01-28 23:31:06 +01:00
parent 07f95bc6ea
commit 5bf68632c3

View file

@ -75,7 +75,12 @@ trait ManufacturerTrait
}
if (null !== $this->getManufacturer()) {
return $this->getManufacturer()->getAutoProductUrl($this->name);
//If possible use the MPN to resolve the auto product URL, otherwise use the parts name
$mpn = $this->getManufacturerProductNumber();
if (empty($mpn)) {
$mpn = $this->getName();
}
return $this->getManufacturer()->getAutoProductUrl($mpn);
}
return ''; // no url is available