Working example how to add product quantity to category...
In catalog/controller/product/category.php
find:
$data['products'][] = array(
add before:
$cart_quantity = '';
if ($this->cart->hasProducts()) {
$cart_products = $this->cart->getProducts();
foreach ($cart_products as $cart_product) {
if (isset($cart_product['product_id']) && $result['product_id'] == $cart_product['product_id']) {
$cart_quantity = $cart_product['quantity'];
}
}
}
after $data['products'][] = array(
add:
'cart_quantity' => $cart_quantity,
in corresponding template file
catalog/view/theme/default/template/product/category.twig
find: <div class="product-thumb">
add after:
{% if product.cart_quantity %} <div style=" padding: 10px; position: absolute; z-index: 1000; color: red; font-weight: bold;">In cart: {{ product.cart_quantity }} pcs.</div>{% endif %}
To add to featured, Latest... in the corresponding files do the same.
To add this modifications you must use OCMOD.
After this changes will be made, you must in admin refresh modifications and clear the cache.