Friends, I need your help.
I want to make the "Out of Stock" status display on the "Add to Cart" button when the quantity in the warehouse becomes "0". Should work in the Category and Product.
I only know this solution:
controller/product/category.php
After: $data['products'][] = array(
Add:
'quantity' => $result['quantity'],
'my_text' => $result['stock_status'],
category.twig
Replace: {{ button_cart }}
To:
{% if product.quantity > 0 %}
{{ button_cart }}
{% else %}
{{ product.my_text }}
{% endif %}
But this method shows all the statuses, but I need only "out of stock"(id=5) and apply disabled="disabled"
to it. Other status names should be displayed and without "disabled".
I know what to start with this:
model/catalog/product.php
After: $query->row['special'],
Add: 'stock_status_id' => $query->row['stock_status_id'],
But what's next?
Sorry for my English. I'm using Google Translate.