Display category name if sku is null. #560
This commit is contained in:
parent
292aae5fa9
commit
317fd0fdf3
2 changed files with 20 additions and 6 deletions
|
|
@ -3046,8 +3046,15 @@ class APIController extends Controller implements LoggedController
|
|||
|
||||
$sku = $warr_serial->getSKU();
|
||||
$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');
|
||||
error_log($cat_name);
|
||||
}
|
||||
|
||||
// TODO: put this in a config file
|
||||
$image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png';
|
||||
|
|
@ -3062,7 +3069,7 @@ class APIController extends Controller implements LoggedController
|
|||
else
|
||||
{
|
||||
$battery = [
|
||||
'brand' => '',
|
||||
'brand' => $cat_name,
|
||||
'size' => '',
|
||||
'image_url' => '',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -253,8 +253,15 @@ 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';
|
||||
|
|
@ -269,7 +276,7 @@ class CustomerWarrantyController extends APIController
|
|||
else
|
||||
{
|
||||
$battery = [
|
||||
'brand' => '',
|
||||
'brand' => $cat_name,
|
||||
'size' => '',
|
||||
'image_url' => '',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in a new issue