the previous "Fix a bug:: check stock per product attribute quantity" (v2) doesn't work if you have products with attribute AND products without attribute.
use checkout_payment.php and checkout_confirmation.php from the previous fix but for shopping_cart.php and general.php use the code below.

for shopping_cart.php :
find these lines:
if (STOCK_CHECK == 'true') {
$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
if (tep_not_null($stock_check)) {
$any_out_of_stock = 1;

$products_name .= $stock_check;
}
}

and replace with:
if (STOCK_CHECK == 'true') {

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
reset($products[$i]['attributes']);
while (list($option, $value) = each($products[$i]['attributes'])) {
$stock_check = tep_check_stock_attribute($products[$i]['id'], $products[$i][$option]['products_attributes_id'], $products[$i]['quantity']);

if (tep_not_null($stock_check)) {
$any_out_of_stock = 1;
$products_name .= '
' . $stock_check;
}

}
} else {
$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
if (tep_not_null($stock_check)) {
$any_out_of_stock = 1;
$products_name .= '
' . $stock_check;
}
}

}

for general.php:
find:
////
// Break a word in a string if it is longer than a specified length ($len)

and add above:
////
// Return a product's stock - ATTRIBUTE
// TABLES: products
function tep_get_products_stock_attribute($products_id, $products_attributes_id) {
$products_id = tep_get_prid($products_id);
$stock_query = tep_db_query("select options_quantity from " . TABLE_PRODUCTS ." p,".TABLE_PRODUCTS_ATTRIBUTES. " pa where p.products_id = '" . (int)$products_id . "'"." AND p.products_id=pa.products_id AND pa.products_attributes_id='".(int)$products_attrib utes_id."'");
$stock_values = tep_db_fetch_array($stock_query);
return $stock_values['options_quantity'];
}

////
// Check if the required stock is available - ATTRIBUTE
// If insufficent stock is available return an out of stock message
function tep_check_stock_attribute($products_id, $products_attributes_id, $products_quantity) {
$stock_left = tep_get_products_stock_attribute($products_id, $products_attributes_id) - $products_quantity;
$out_of_stock = '';

if ($stock_left < 0) {
$out_of_stock = '' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '';
}

return $out_of_stock;
}

NOTE: THIS IS A BLANK FILE

More...