Fix product version system #15

Closed
jedateach opened this Issue Mar 13, 2012 · 2 comments

Projects

None yet

1 participant

@jedateach

Historical product information should always be available via the SilverStripe Versioned system. This means product prices, titles etc will all be available...and can even be accessed from deleted products.

The system has been failing however, as Versioned.php has a bug, where if a version is not available, it outputs a debug message, breaking sites sometimes completely.

The error most people will receive is, for example:

[User Error] Versioned::get_version: Couldn't get Product.389, version 2

This is merely produced by a debug statement / error that the sapphire core. Versioned.php line 920, 980, and 998

@jedateach

I may disable recording / retrieving product versions completely in the next version, but provide the option to re-enable, with a patch for Versioned.php. The problem won't fully be solved until the module is upgraded to work with Silverstripe3.

An alternative may be to use Object::useCustomClass("Versioned","FixedVersioned"); I'm not sue if you can use this with decorators.

Or...it may be possible to catch the error with a custom error handler.
http://verysimple.com/2010/11/02/catching-php-errors-warnings-and-notices/
http://stackoverflow.com/questions/277224/how-do-i-catch-a-php-fatal-error
...very hacky, and probably not a good idea.

@jedateach jedateach added a commit that referenced this issue Apr 17, 2012
@jedateach jedateach BUGFIX: Temporary solution for fixing Versioned, to allow storing pro…
…duct versions against order items.

Fixes issue #15
9f88579
@jedateach

Still needs proper unit tests written

@jedateach jedateach closed this Jul 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment