Jump to content

Product catalog, color problem for quantity 0.


mirkodescalchi

Recommended Posts

Hello people,
a very small question to the most experienced:


Usage lends the latest version 1.7.8.5 updated and in the product list of the catalog, if an article has 0 as a quantity, it is not colored red (photo 1). This happens instead in the Product list function in the creation of a new article (photo 2).

I'm literally going crazy looking for a setting / modification to solve because a red color would allow me an immediate vision of the unavailable products.

Any indication?

Thank you for your time.

1.jpg

2.jpg

Link to comment
Share on other sites

Hello,

Please follow this>

Edit: public_html/src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/list.html.twig  file

on line 64 find {% if 'PS_STOCK_MANAGEMENT'|configuration %}  and add this code after/below  

After {% if 'PS_STOCK_MANAGEMENT'|configuration %}

Replace the code to this (please look at the screenshot where it should be)

           {% if product.sav_quantity == 0 %}
         <td class="product-sav-quantity text-center" data-product-quantity-value="{{ product.sav_quantity|default('') }}">
          <a href="{{ product.url|default('') }}#tab-step3" style="background:red; padding: 5px 5px;">
                    {% if product.sav_quantity is defined and product.sav_quantity > 0 %}
                        {{ product.sav_quantity }}
                    {% else %}
                        {{ product.sav_quantity|default('N/A'|trans({}, 'Admin.Global')) }}
                    {% endif %}
                </a>
                </td>
         {% else %}
         
                <td class="product-sav-quantity text-center" data-product-quantity-value="{{ product.sav_quantity|default('') }}">
                <a href="{{ product.url|default('') }}#tab-step3">
                    {% if product.sav_quantity is defined and product.sav_quantity > 0 %}
                        {{ product.sav_quantity }}
                    {% else %}
                        {{ product.sav_quantity|default('N/A'|trans({}, 'Admin.Global')) }}
                    {% endif %}
                </a>
            </td>
            {% endif %}
        {% else %}
            <td></td>
        {% endif %}

 

save it, clear cache and then check the results! (you can play with it along if you need deffirent areas in red)

 

Please hit the like button if you find this helpful

Regards

Edited by Mian Waqas
Code edit (see edit history)
  • Thanks 1
Link to comment
Share on other sites

HI SMT,

You have been amazing and thank you so much for your interest in my question. I changed the code as you indicated and the quantity now has a red background box (not the number).
This change, however, added a column causing a misalignment.
I think it is easier to color the quantity = 0 on Red. Do you think it is possible?
Thanks again.

1.jpg

Link to comment
Share on other sites

Hi,

Yes new code, 

After {% if 'PS_STOCK_MANAGEMENT'|configuration %}

Replace the code to this (please look at the screenshot where it should be)

           {% if product.sav_quantity == 0 %}
         <td class="product-sav-quantity text-center" data-product-quantity-value="{{ product.sav_quantity|default('') }}">
          <a href="{{ product.url|default('') }}#tab-step3" style="background:red; padding: 5px 5px;">
                    {% if product.sav_quantity is defined and product.sav_quantity > 0 %}
                        {{ product.sav_quantity }}
                    {% else %}
                        {{ product.sav_quantity|default('N/A'|trans({}, 'Admin.Global')) }}
                    {% endif %}
                </a>
                </td>
         {% else %}
         
                <td class="product-sav-quantity text-center" data-product-quantity-value="{{ product.sav_quantity|default('') }}">
                <a href="{{ product.url|default('') }}#tab-step3">
                    {% if product.sav_quantity is defined and product.sav_quantity > 0 %}
                        {{ product.sav_quantity }}
                    {% else %}
                        {{ product.sav_quantity|default('N/A'|trans({}, 'Admin.Global')) }}
                    {% endif %}
                </a>
            </td>
            {% endif %}
        {% else %}
            <td></td>
        {% endif %}

It should be like this

image.thumb.png.91c9b1f128cabec748e0398feb6e00f0.png

 

Edited by Mian Waqas
Code change (see edit history)
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...