You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into an issue where when a user has added only a vehicle year to their garage, the 'remove' function gets a bit buggy. This is because the removeVehicle() function is doing an if statement to confirm the object in the session matches the object being removed. I've stepped through the code here.
This is where it gets messed up. The if statement there does a check to see that the objects are the same exact objects. The problem is that they're not:
Here I dump the vehicle object from the session and compared it to the vehicle object in the $this->vehicles() list:
You can see that the last value of 'model' does not match. I believe this causes the whole method to evaluate false and then not finish removing the year from the list of garaged-vehicles.
I'd like to fix this by finding the method which adds the vehicle to the session to make sure it just pops the '0' in there, making them match. But, I wasn't able to find where that happened yet. It just needs to put in a default value. I may try to resolve this temporarily by modifying this check to be more forgiving, or perhaps update all the values before the check so that works.
In any case - hopefully there's enough information here for someone to easily resolve the issue.
The text was updated successfully, but these errors were encountered:
Hi All
I'm running into an issue where when a user has added only a vehicle year to their garage, the 'remove' function gets a bit buggy. This is because the
removeVehicle()
function is doing an if statement to confirm the object in the session matches the object being removed. I've stepped through the code here.The remove link fires the controller:
https://github.com/vehiclefits/vfmagento/blob/master/app/code/local/Elite/Vafgarage/controllers/RemoveController.php#L27
The session data is an object of the data model, so it calls up the removeVehicle method in that class:
https://github.com/vehiclefits/vfmagento/blob/master/app/code/local/Elite/Vafgarage/Model/Garage.php#L36-L42
This is where it gets messed up. The if statement there does a check to see that the objects are the same exact objects. The problem is that they're not:
Here I dump the vehicle object from the session and compared it to the vehicle object in the
$this->vehicles()
list:You can see that the last value of 'model' does not match. I believe this causes the whole method to evaluate false and then not finish removing the year from the list of garaged-vehicles.
I'd like to fix this by finding the method which adds the vehicle to the session to make sure it just pops the '0' in there, making them match. But, I wasn't able to find where that happened yet. It just needs to put in a default value. I may try to resolve this temporarily by modifying this check to be more forgiving, or perhaps update all the values before the check so that works.
In any case - hopefully there's enough information here for someone to easily resolve the issue.
The text was updated successfully, but these errors were encountered: