Quote Originally Posted by tajul_ashyqin View Post
Hi Frank,

Thanx for your posted fixes... and actually, instead of showing the stock values beside the respective attributes option, I just want to show the 'Out of Stock' remark to only for those attributes that has reach to 0 in quantity BUT no remarks to the one that still have stock. So that next time the online shoppers no need to 'choose' and 'add to cart' the attributes and then find that no stock available to order!!! Do you have any idea how to code that?! or anyone out there?!
In my situation, I have very limited stock level on each attribue. So, I wanted customers to see the quantities on each attribute, so that they would not add more than what's available. I also turned "show stock when low" in admin under Configuration/Stock, so that if my customers did add more than available quantities, they would get an warning message and show available stock in shopping cart.

In your situation, I assume that you have plenty merchandise in stock and you have a very tight stock level control in place. I would suggest another fix posted by Grayson before:

1. Switch back to original attributes.php by kuroi
2. If you want to force attribute selection, add a "display only" attribute as "default" selection
3. In attribute.php find
[FONT=Times New Roman]$products_options_details = $products_options->fields['products_options_values_name'];[/FONT]
replace it with:
if ($products_options->fields['quantity'] > 0) { $products_options_details = $products_options->fields['products_options_values_name']; } else { $products_options_details = $products_options->fields['products_options_values_name'] . ' [' . TEXT_ATTRIBUTES_NOT_IN_STOCK . ']'; }
next replace
[FONT=Times New Roman]$products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');[/FONT]
with
if ($products_options->fields['quantity'] > 0) { $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : ''); } else { $products_options_details_noname = ' [' . TEXT_ATTRIBUTES_NOT_IN_STOCK . ']' . $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : ''); }
A few lines below this, find
[FONT=Times New Roman]
[FONT=Times New Roman]$products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');[/FONT]
[/FONT]

Replace with:
if ($products_options->fields['quantity'] > 0) { $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : ''); } else { $products_options_details_noname = ' [' . TEXT_ATTRIBUTES_NOT_IN_STOCK . '] ' . $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');}
Do NOT forget to add a define of [FONT=Verdana]TEXT_ATTRIBUTES_NOT_IN_STOCK[/FONT] in product_info.php in includes/languages/english/your_template folder!!