diff --git a/src/Controller/CAPI/CustomerWarrantyController.php b/src/Controller/CAPI/CustomerWarrantyController.php index 832c2466..834aee8d 100644 --- a/src/Controller/CAPI/CustomerWarrantyController.php +++ b/src/Controller/CAPI/CustomerWarrantyController.php @@ -244,8 +244,14 @@ class CustomerWarrantyController extends APIController $sku = $warr_serial->getSKU(); // check if sku is null $batt = null; + $cat_name = ''; if ($sku != null) $batt = $em->getRepository(SAPBattery::class)->find($sku); + else + { + // get the category name of the serial + $cat_name = $warr_serial->getMetaInfo('category_name'); + } // TODO: put this in a config file $image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png'; @@ -260,7 +266,7 @@ class CustomerWarrantyController extends APIController else { $battery = [ - 'brand' => '', + 'brand' => $cat_name, 'size' => '', 'image_url' => '', ];