Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vehicle from garage when only have year false-y bug #75

Open
drmmr763 opened this issue Aug 10, 2014 · 0 comments
Open

Remove vehicle from garage when only have year false-y bug #75

drmmr763 opened this issue Aug 10, 2014 · 0 comments

Comments

@drmmr763
Copy link
Contributor

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:

The session object:
array(3) {
  ["year"]=>
  string(2) "77"
  ["make"]=>
  string(1) "0"
  ["model"]=>
  string(1) "0"
}

$this->vehicles() object:
array(3) {
  ["year"]=>
  string(2) "77"
  ["make"]=>
  string(1) "0"
  ["model"]=>
  string(0) ""
}

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant