How to display product quantity in Prestashop

Aryan G picture Aryan G · Jan 7, 2015 · Viewed 9k times · Source

I'm using one of the default themes included with . Is it possible to display product quantity values for a product based on size and color within the product box on the homepage?

Answer

davidcondrey picture davidcondrey · Jan 9, 2015

See this thread on Prestashop.com forum. It looks like someone else asked a similar question and was able to get it working with this code:

{*Added quantity in stock*}
<!-- availability -->
<p id="availability_statut"{if ($product.quantity <= 0 && !$product.available_later && $allow_oosp) OR ($product.quantity > 0 && !$product.available_now) OR !$product.available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
    <span id="availability_label">{l s='Availability:'}</span>
    <span id="availability_value"{if $product.quantity <= 0} class="warning_inline"{/if}>
        {if $product.quantity <= 0}{if $allow_oosp}{$product.available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product.available_now}{/if}
    </span>
</p>

<!-- number of item in stock -->
{*if ($display_qties == 1 && !$PS_CATALOG_MODE && $product.available_for_order) *}
<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 in stock'}</span>
    <span {if $product.quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}</span>
</p>

<!-- Out of stock hook -->
<p id="oosHook"{if $product.quantity > 0} style="display: none;"{/if}>
    {$HOOK_PRODUCT_OOS}
</p>

<p class="warning_inline" id="last_quantities"{if ($product.quantity > $last_qties OR $product.quantity <= 0) OR $allow_oosp OR !$product.available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p>
{*End Added quantity in stock*} 

and in this other post also on Prestashop.com, someone reported that they were able to display quantities specific to the product size attribute using this Prestashop module. {/if}