In v1.5, an additional check of Products/Attributes was added for when Attributes are removed from a Product to prevent this ...
I am not sure how difficult it might be to back port that change to v1.3.9h, to add the extra check needed for when a customer has a saved cart of Products with old Attributes that have been removed ...
I have not tested this completely, but you can try adding the code in RED:
/includes/classes/shopping_cart.php
Code:
// validate cart contents for checkout
if ($check_for_valid_cart == true) {
$fix_once = 0;
// Check products_status if not already
$check_status = $products->fields['products_status'];
if ( $check_status == 0 ) {
$fix_once ++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
$this->remove($products_id);
// bof: extra check for products/attributes
} else {
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
$chkcount = 0;
while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
$chkcount ++;
$chk_attributes_exist_query = "select products_id
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa
where pa.products_id = '" . (int)$products_id . "'
and pa.options_values_id = '" . (int)$value . "'";
$chk_attributes_exist = $db->Execute($chk_attributes_exist_query);
//echo 'what is it: ' . ' : ' . $products_id . ' - ' . $value . ' records: ' . $chk_attributes_exist->RecordCount() . ' vs ' . print_r($this->contents[$products_id]) . '<br>';
if ($chk_attributes_exist->EOF) {
$fix_once ++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT_ATTRIBUTES . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES . '<br />';
$this->remove($products_id);
break;
}
}
}
// bof: extra check for products/attributes
}
// check only if valid products_status
and add the language defines for:
Code:
define('ERROR_PRODUCT_ATTRIBUTES','<br />The item: ');
define('ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES','<br />We are sorry but selected options have changed for this product and have been removed from our inventory at this time.<br />This item has been removed from your shopping cart.');
to the bottom of english.php (these will be in that file when you upgrade to v1.5, in the future)
Bookmarks