Jump to content

Availability information on the In Stock


Maria Costa

Recommended Posts

This is not advice for a few minutes.
If you do not have programming knowledge of Prestashop, it is difficult for anyone to advise.
It would be best to hire someone to modify it.
In your case, just look at the addFlags function in the ./src/Core/Product/ProductPresenter.php file.
You will create your own condition and create your own CSS style.

 

if ($product['quantity'] > 0) {
            $flags['in-stock'] = array(
                'type' => 'custom-in-stock',
                'label' => $this->translator->trans('Custom in stock', array(), 'Shop.Theme.Catalog'),
            );
        }
        
        if ($product['quantity'] < 1) {
            $flags['out-of-stock'] = array(
                'type' => 'custom-out-of-stock',
                'label' => $this->translator->trans('Custom out of stock', array(), 'Shop.Theme.Catalog'),
            );
        }

 

Edited by Guest (see edit history)
Link to comment
Share on other sites

Or it can be done more simply by editing the TPL template and creating a css style.
E.g. ./themes/classic/templates/catalog/_partials/miniatures/product.tpl

product.tpl:

obrazek.png.7b9224fc0284cb64f059ca7a8103074c.png

CSS:

obrazek.png.d942f4a26ddb21c4d50a30771fb24e77.png

 

obrazek.png.1c928b19bb3a1c869079132e4d840141.png

 

When you upgrade to Prestashop 1.7.6 and higher, there is already a "actionProductFlagsModifier" hook, which can be used in the module and change your own label as you wish.

Edited by Guest (see edit history)
Link to comment
Share on other sites

23 horas atrás, Guest disse:

Ou pode ser feito de forma mais simples editando o modelo TPL e criando um estilo css.
Por exemplo, ./themes/classic/te mplates / catalog / _partials / miniatures / product.tpl

product.tpl :

obrazek.png.7b9224fc0284cb64f059ca7a8103074c.png

CSS:

obrazek.png.d942f4a26ddb21c4d50a30771fb24e77.png

 

obrazek.png.1c928b19bb3a1c869079132e4d840141.png

 

Quando você atualiza para Prestashop 1.7.6 e superior, já existe um gancho "actionProductFlagsModifier", que pode ser usado no módulo e alterar seu próprio rótulo como desejar.

 

Hello, thank you very much for your help,  should i paste this code in product.tpl?

obrazek.png.7b9224fc0284cb64f059ca7a8103074c.png

 

 

I apologize for my English 

Edited by Maria Costa (see edit history)
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...