Jump to content

1.6 Remove Available Product Quantity, But Keep "in Stock" Text


seastars

Recommended Posts

I need help to figure out how to remove the available quantity of in stock items on the product page, but leave the "in stock" text.

Also I would like the text to behave as this:

5 or less items in stock = "few in stock"

more than 5 items in stock = "in stock"

0 in stock = "out of stock"

 

If anyone has a solution just with icons or colors (like red, orange, green) please share as well.

Thanks!

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

Hi you need go to

 

themes/YOURTHEMENAME/product.tpl 

 

 

and look for 

                    <!-- number of item in stock -->
                    <p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
                        <span id="quantityAvailable">{$product->quantity|intval}</span>
                        <span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item'}</span>
                        <span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items'}</span>
                    </p>

1 Delete these block  (these don't show the quantity)

 

 

after that see 

                <!-- availability or doesntExist -->
                <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}>
                    {*<span id="availability_label">{l s='Availability:'}</span>*}
                    <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>
                {if $PS_STOCK_MANAGEMENT}
                    {if !$product->is_virtual}{hook h="displayProductDeliveryTime" product=$product}{/if}
                    <p class="warning_inline" id="last_quantities"{if ($product->quantity > $last_qties || $product->quantity <= 0) || $allow_oosp || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p>
                {/if}

Here you can change the values and message 

Link to comment
Share on other sites

  • 2 months later...

Hi there,

 

I used this:

<p id="pQuantityAvailable">
                    {if $product->quantity <= 0}<span class="label-danger" style="padding: 3px 8px 4px;">{l s='None Left'}</span>
                    {elseif $product->quantity<5}<span class="label-warning" style="padding: 3px 8px 4px;">{l s='Less than 5 left'}</span>
                    {else} <span class="label-success" style="padding: 3px 8px 4px;">{l s='In stock'}</span>
                    {/if}
                </p>
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...