Jump to content

How can be set a automatic default value to all products, in "Displayed text when in-stock" form?

Recommended Posts

I would like to set an automatic default value to all products, in "Displayed text when in-stock" form, in quantities produtcs tab.
Can someone give me a hand?
This is what i had discovered so far:
In Prestashop Admin the form is here:
Admin->Catalog->Products->Quantities->Displayed text when in-stock
On server the file that must be edited is:
On quantities.tpl file i need to edit line 248: "input_value=$product->available_now"
{if $ps_stock_management}
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="available_now" type="default" multilang="true"}</span></div>
<label class="control-label col-lg-2" for="available_now_{$default_language}">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='Forbidden characters:'} <>;=#{}">
{l s='Displayed text when in-stock'}
<div class="col-lg-9">
{include file="controllers/products/input_text_lang.tpl"
My question is:
How can i edit this line: input_value=$product->available_now
so the automatic default value "In stock" is set to all products in shop?
I have replaced input_value=$product->available_now with input_value="In stock" but in admin shop is displayed only "s" value.



Edited by rl_lucian (see edit history)

Share this post

Link to post
Share on other sites
I have found the solution:


The file needed to be edited is product.tpl (/public_html/themes/YourTheme/product.tpl)


1. I deactivated the lines 207-211


<p id="availability_statut"{if !$PS_STOCK_MANAGEMENT || ($product->quantity <= 0 && !$product->available_later && $allow_oosp) || ($product->quantity > 0 && !$product->available_now) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>

<label id="availability_label" class="attribute_label">{l s='Availability:'}</label>

<span id="availability_value" class="label{if $product->quantity <= 0 && !$allow_oosp} label-danger{elseif $product->quantity <= 0} label-warning{else} label-success{/if}">{if $product->quantity <= 0}{if $PS_STOCK_MANAGEMENT && $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{elseif $PS_STOCK_MANAGEMENT}{$product->available_now}{/if}</span>



2. And added this code, under the original one:



<label>{if $product->quantity > 0}<div class='instoc'>{l s='Disponibilitate:'}           <span style="color:#41ae53">{l s='In stoc'}</span></div>{else}<div class='outofstoc'>{l s='Disponibilitate:'}           <span style="color:#F13340">{l s='Produsul nu se afla momentan pe stoc'}</span></div>{/if} </label>




Share this post

Link to post
Share on other sites

This is what I was looking for. Thanks!

Do you know how can I add the colored text box around the text? 


Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More