Jump to content
rl_lucian

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

Recommended Posts

Hello,
 
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
 
Selection_005.png
 
On server the file that must be edited is:
/public_html/admin/themes/default/template/controllers/products/quantities.tpl
 
On quantities.tpl file i need to edit line 248: "input_value=$product->available_now"
 
Selection_006.png
 
 
{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'}
</span>
</label>
<div class="col-lg-9">
{include file="controllers/products/input_text_lang.tpl"
languages=$languages
input_value=$product->available_now
input_name='available_now'}
</div>
</div>
 
====================================================================
 
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?
 
PS:
I have replaced input_value=$product->available_now with input_value="In stock" but in admin shop is displayed only "s" value.
 
Thanks!

post-888533-0-48856800-1475132600_thumb.png

post-888533-0-05282900-1475132601_thumb.png

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>

</p>

 

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

 

<p>

<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>

</p>

 

360cf50940.png

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? 

Catalin

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