That can definitely be done, but it’s fairly wasteful to use a whole resource and a bunch of TVs for every car and searches would be very complicated and very slow. Both resources and TVs carry a lot of overhead that you don’t need at all and the TVs would require a complex search strategy. The code to add a new car would also be a pain to implement and all the code would be hard to maintain because you’d have no separation between the model and the view.
I’d suggest importing the CSV file (or the original table) into the MODx DB, but with your own table prefix in the table name (call the table something like ’griz_cars’). Add any indexes you want for the table. Then use a procedure like the one described here:
http://bobsguides.com/custom-db-tables.html to create the schema, class, and map files for the table.
That will make the table xPDO-friendly. Once you’ve done that, adding cars, displaying them, and searching for subsets of them will be infinitely easier and faster. Here are a couple of examples:
<?php
/* add new car */
$feilds = array(
'make'=>'ford',
'model'=>'mustang',
'doors'=>'4',
'miles'=>'23,231',
'engine_type'='diesel'
);
$car = $modx->newObject('car',$fields);
$car->save();
/* Find all fords */
$cars = $modx->getCollection('cars',array('make'=>'ford'));
foreach($cars as $car) {
$output .= '<br />MAKE: ' . $car->get('make');
$output .= '<br />MODEL: ' . $car->get('mode';);
// etc.
}
return $output;