All we are doing is pulling the quantity from the database into a data parameter,
Then switching on the add to cart buttons of that value is not zero.
First we pull the quantity value from the database and into a data parameter:
In file:/catalog/controller/product/product.php
Find:
Code: Select all
if ($product_info['quantity'] <= 0) {
Code: Select all
$data['stockb'] = $product_info['quantity'];
Then we switch the buttons on and off depending on if the value is zero or not with a simple 'if' statement
In file /catalog/view/template/product/product.twig
Find:
Code: Select all
<button type="submit" id="button-cart" class="btn btn-primary btn-lg btn-block">{{ button_cart }}</button>
Code: Select all
{% if stockb > 0 %}
Code: Select all
{% endif %}
Cheers.
Psi