burnbright/silverstripe-shop — Issue #6: Issues with non existent version / language change
Author: jedateach
Created: 2012-03-04 20:55:02+00:00
State: open

To know the problem more I've added a product in English and I've added the same product in French, so on English front-end when I added the product to the cart and switch back to French and I get the following problem:

Debug (Versioned::get_version() in line 978 of Versioned.php)

SELECT "SiteTree_versions"."ClassName", ....

Debug (Versioned::get_version() in line 979 of Versioned.php)

(bool) false

[User Error] Versioned::get_version: Couldn't get Product.389, version 2
GET /SilverStripe-v2.4.7/products/filter/

Line 980 in D:\server\www\SilverStripe-v2.4.7\sapphire\core\model\Versioned.php
Source

971	Versioned::set_reading_mode('');
972
973	$baseTable = ClassInfo::baseDataClass($class);
974	$query = singleton($class)->buildVersionSQL("\"{$baseTable}\".\"RecordID\" = $id AND \"{$baseTable}\".\"Version\" = $version");
975	$record = $query->execute()->record();
976	$className = $record['ClassName'];
977	if(!$className) {
978	Debug::show($query->sql());
979	Debug::show($record);
980	user_error("Versioned::get_version: Couldn't get $class.$id, version $version", E_USER_ERROR);
981	}
982
983	Versioned::set_reading_mode($oldMode);
984	return new $className($record);
985	}
986