You could create the file /includes/extra_cart_actions/validate.php. Note that this file can be named anything you want; it just needs to be in this directory.
In this file, you could check for the cart-related action (add-to-cart is the only one you need to care about, since your products have attributes). If attributes are included in the POST data (the 'id' values), then check for the VIN-related option name/value pair (you can see their values in your admin's Attribute Controller). If an error exists with the data, write a message to the header (so it will be seen on all pages) and then redirect to the return-page for the cart-related actions.
Best thing: No core file overrides.
Code:
<?php
global $messageStack;
if ($_GET['action'] == 'add_product') {
/*---- Add a product to cart ----
*/
if (isset($_POST['products_id']) && $_POST['cart_quantity'] > 0) {
if (isset($_POST['id'])) {
foreach($_POST['id'] as $option => $value) {
if ($option == VIN_OPTION_NUMBER) {
<do some checking on the vin entered>
if( $vin_error) {
$messageStack->add_session('header', ERROR_VIN_ERROR);
zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
}
}
}
}
}
}