Resolve "Command to make battery compatibility json" #1059

Merged
korina.cordero merged 2 commits from 212-command-to-make-battery-compatibility-json into master 2019-05-27 01:58:40 +00:00
Showing only changes of commit 92c0f2d169 - Show all commits

View file

@ -36,7 +36,7 @@ class GenerateBatteryCompatibilityCommand extends Command
foreach ($vms as $vm)
{
$mfg_name = $vm->getName();
$this->vmfg_index[$mfg_name] = $vm;
// $this->vmfg_index[$mfg_name] = [];
// get vehicles from manufacturer
$make_array = [];
@ -51,7 +51,8 @@ class GenerateBatteryCompatibilityCommand extends Command
$comp_batt['id'] = $battery->getID();
$comp_batt['name'] = $battery->getModel()->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();
// store the selling price for comparison
@ -67,10 +68,16 @@ class GenerateBatteryCompatibilityCommand extends Command
//$comp_batt['description'] = $battery->getDescription();
}
}
$make_array[$vehicle->getMake()][$vehicle->getModelYearFormatted()] = $comp_batt;
// check if no compatible batteries
if (!empty($comp_batt))
$make_array[$vehicle->getMake()][$vehicle->getModelYearFormatted()] = $comp_batt;
}
$this->vmfg_index[$mfg_name] = $make_array;
// check if empty
if (!empty($make_array))
$this->vmfg_index[$mfg_name] = $make_array;
}