Add category name in response if sap battery is null. #562
This commit is contained in:
parent
4d1859afa4
commit
3488d5f9a9
1 changed files with 7 additions and 1 deletions
|
|
@ -244,8 +244,14 @@ class CustomerWarrantyController extends APIController
|
||||||
$sku = $warr_serial->getSKU();
|
$sku = $warr_serial->getSKU();
|
||||||
// check if sku is null
|
// check if sku is null
|
||||||
$batt = null;
|
$batt = null;
|
||||||
|
$cat_name = '';
|
||||||
if ($sku != null)
|
if ($sku != null)
|
||||||
$batt = $em->getRepository(SAPBattery::class)->find($sku);
|
$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
|
// TODO: put this in a config file
|
||||||
$image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png';
|
$image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png';
|
||||||
|
|
@ -260,7 +266,7 @@ class CustomerWarrantyController extends APIController
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$battery = [
|
$battery = [
|
||||||
'brand' => '',
|
'brand' => $cat_name,
|
||||||
'size' => '',
|
'size' => '',
|
||||||
'image_url' => '',
|
'image_url' => '',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue