Fix bug in battery:generate_compatibility_json command #212
This commit is contained in:
parent
144156e377
commit
92c0f2d169
1 changed files with 11 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ class GenerateBatteryCompatibilityCommand extends Command
|
||||||
foreach ($vms as $vm)
|
foreach ($vms as $vm)
|
||||||
{
|
{
|
||||||
$mfg_name = $vm->getName();
|
$mfg_name = $vm->getName();
|
||||||
$this->vmfg_index[$mfg_name] = $vm;
|
// $this->vmfg_index[$mfg_name] = [];
|
||||||
|
|
||||||
// get vehicles from manufacturer
|
// get vehicles from manufacturer
|
||||||
$make_array = [];
|
$make_array = [];
|
||||||
|
|
@ -51,7 +51,8 @@ class GenerateBatteryCompatibilityCommand extends Command
|
||||||
$comp_batt['id'] = $battery->getID();
|
$comp_batt['id'] = $battery->getID();
|
||||||
$comp_batt['name'] = $battery->getModel()->getName() . ' ' .
|
$comp_batt['name'] = $battery->getModel()->getName() . ' ' .
|
||||||
$battery->getSize()->getName();
|
$battery->getSize()->getName();
|
||||||
$comp_batt['image_url'] = $battery->getImageFile();
|
$comp_batt['image_url'] = '/assets/img/products/' . strtolower($battery->getModel()->getName()) . '.png';
|
||||||
|
$comp_batt['description'] = '';
|
||||||
//$comp_batt['description'] = $battery->getDescription();
|
//$comp_batt['description'] = $battery->getDescription();
|
||||||
|
|
||||||
// store the selling price for comparison
|
// store the selling price for comparison
|
||||||
|
|
@ -67,9 +68,15 @@ class GenerateBatteryCompatibilityCommand extends Command
|
||||||
//$comp_batt['description'] = $battery->getDescription();
|
//$comp_batt['description'] = $battery->getDescription();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if no compatible batteries
|
||||||
|
if (!empty($comp_batt))
|
||||||
$make_array[$vehicle->getMake()][$vehicle->getModelYearFormatted()] = $comp_batt;
|
$make_array[$vehicle->getMake()][$vehicle->getModelYearFormatted()] = $comp_batt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if empty
|
||||||
|
if (!empty($make_array))
|
||||||
$this->vmfg_index[$mfg_name] = $make_array;
|
$this->vmfg_index[$mfg_name] = $make_array;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue