A
A
Artyom2018-11-13 10:06:44
opencart
Artyom, 2018-11-13 10:06:44

How to make product status color on category page?

Hello. Made a product status output (from the admin panel) on the category page. Tell me how to make the product with the status "In stock" green, "Out of stock" - red, "On order" blue?
I thought of assigning it to css, but in this case it becomes green for all statuses.

}
.stock-status {
    color: green;
}

5bea77bcaf0ac656988817.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita, 2018-11-13
@SweetBubaleh

$(function () {
        if($('.text').text('В наличии'))
            $(this).css('color', 'green');
        else
            $(this).css('color', 'red');
    });

Z
zoozag, 2018-11-13
@zoozag

Assign a different class depending on the status.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question