Page 1 of 1

[SOLVED] Changing quantity color in product list in admin

Posted: Thu Jan 20, 2022 12:35 am
by Joe1234
I edited the file "admin/view/template/catalog/product_list.twig" in order to change the color of the quantity in the product list in the admin, but I'm not seeing any change.
Line 174

Code: Select all

<td class="text-right">{% if product.quantity <= 0 %} <span class="label label-warning">{{ product.quantity }}</span> {% elseif product.quantity <= 5 %} <span class="label label-danger">{{ product.quantity }}</span> {% else %} <span class="label label-success">{{ product.quantity }}</span> {% endif %}</td>
Am I in the wrong file or wrong line? I refreshed the cache and browser.

Thanks.

Re: Changing quantity color in product list in admin

Posted: Thu Jan 20, 2022 12:50 am
by Gergely
Hi Joe1234,

At a glance, that looks like the original code to me. What did you change it to?
Directly editing core files is strictly not recommended, and not at all necessary in this case. You should include the necessary rules in a custom css stylesheet instead.

As to why the changes are not showing up, one can only guess:
Do you have any modifications installed? If so, make sure to refresh modifications via Admin > Extensions > Modifications > Refresh button in the top right corner.

Hope this is useful, let me know if you need further help with this!
Gergely

Re: Changing quantity color in product list in admin

Posted: Thu Jan 20, 2022 12:56 am
by thekrotek
The code looks fine to me, but you could make is much smaller. Something like this:

Code: Select all

<td class="text-right"> <span class="label label-{{ product.quantity <= 0 ? "warning" : (product.quantity <= 5 ? "danger" : "success") }}"></span></td>

Re: Changing quantity color in product list in admin

Posted: Thu Jan 20, 2022 1:25 am
by DigitCart
Hi
Also, If the theme cache is enabled, You need to refresh it from the admin dashboard / gear icon (developer settings)

Re: Changing quantity color in product list in admin

Posted: Thu Jan 20, 2022 3:27 am
by Joe1234
@Gergely, That was the original code, I posted that so people would know exactly what I was trying to edit. You were right about the modification refresh, that fixed it thanks. Yes I know editing the files directly isn't the best, but I just can't be bothered to search for the right stylesheet, then the right class, and figure out the right coding, ahhhh. It is easier for me to just grab the file that's clearly named and find the spot that I need to edit. My edits are simple and not that many, it's easier to do that and document it for when I upgrade.

Re: Changing quantity color in product list in admin

Posted: Fri Jan 21, 2022 7:43 pm
by paulfeakins