Jump to content

Show number of available items in product listing 1.6.0.14


MyValeria

Recommended Posts

Hi everybody,

 

I'm working on PS 1.6.0.14, using the default theme.

 

I'd like to add the number of available products in product listing. See attachment for a better understanding.

post-558663-0-72249300-1427062360_thumb.jpg

 

Anyone who could please help?

 

Many thanks.

Ciao,

Valeria

Link to comment
Share on other sites

Hi!

 

I did an adjustment to this in my theme.

 

Locate product-list.tpl in your theme and then find

{if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}

 

after that line i replaced the code with this:

 

{if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                        {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                            <span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="availability">
                                {if ($product.allow_oosp || $product.quantity > 0)}
                                    <span class="{if $product.quantity <= 0 && !$product.allow_oosp}out-of-stock{else}available-now{/if}">
                                        <link itemprop="availability" href="http://schema.org/InStock" />
                                        {if $product.available_date > $smarty.now|date_format:'%Y-%m-%d'}{l s='Availability date:'} {dateFormat date=$product.available_date full=false}
                                        
                                        {elseif $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later || $product->available_date < $smarty.now|date_format:'%Y-%m-%d'}{$product.available_later}
                                        {else}
                                        {l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}
                                        {else}
                                        {if isset($product.available_now) && $product.available_now}Lager: {$product.quantity}st
                                        {else}
                                        {l s='In Stock'}{/if}{/if}
                                    </span>
                                    
                                {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                                    <span class="available-dif">
                                        <link itemprop="availability" href="http://schema.org/LimitedAvailability" />{l s='Product available with different options'}
                                    </span>
                                {else}
                                    <span class="out-of-stock">
                                        <link itemprop="availability" href="http://schema.org/OutOfStock" />{l s='Out of stock'}
                                    </span>
                                {/if}
                            </span>
                        {/if}
                    {/if}

 

Then you can use the stock handling in BO to insert the text and stock you want there.

Link to comment
Share on other sites

Im sorry i dont understand how to display the number in stock without using stock handling? I dont mean Advanced stock handling but instead the standard handling.

 

Ops! I'm sorry teralite.

I think I've misundertood your message, thinking you're referring to Advanced Stock handling :D

 

I'm going to give your code a go and let you know if it's working.

Link to comment
Share on other sites

Try to add this aswell in product-list.css in your theme.

 

ul.product_list .availability span {
  display: inline-block;
  color: #000;
  font-weight: bold;
  padding: 3px 4px 0px 10px;
  margin-bottom: 10px; }
  ul.product_list .availability span.available-now {
    }
  ul.product_list .availability span.out-of-stock {
    background: #ff7430;
    border: 1px solid #ea5e1a; }
  ul.product_list .availability span.available-dif {
    background: #ff7430;
    border: 1px solid #ea5e1a; }
Link to comment
Share on other sites

And also remember that to show the number in stock you have to fill it in on each product, otherwise it will show the text for when a product is out of stock. If you put in an estimated date that the product is back in stock, that will show first.

Link to comment
Share on other sites

Hi teralite.

 

I've also added the CSS code but I'm afraid I can't see any changes. Still no number of available items in product box - grid view.

And there are 100 pcs in the stock.

 

Would you mind sending me the link to your site, so to understand the behaviour of your code?

 

Thanks.

Valeria

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