PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

[Solved] Stockmessage only showing on product page, not on product listing.

6 replies to this topic
#1
msk69

    PrestaShop Apprentice

  • Members
  • PipPip
  • 403 posts
I just discovered that if i make a custom stock message only in the ...when out of stock: field that it is not showing on the product info page. After i add a custom message in ....when in stock: then the out of stock message will show up.

Is that a bug?

Also i'd like to see in the custom message in the product listing, couse now if it is out of stock, and ordering the product is allowed on the product-listing it show: in stock, while there is no stock! Bug?

Is there anyone who knows a code solution to show up the custom ...when out of stock: text in the product listing?

Thanks in advanced.

Marco

Attached Files



#2
peej

    PrestaShop Newbie

  • Members
  • Pip
  • 24 posts
Hi there,

It seems to be more questions than answers on this topic. I have found several threads requesting this functionality and no answers. However it should not be that hard to find a solution. The nessesary code is already in the product details and it shouldn't be that much job to implement it into the product-list.tpl and homefeatured.

I would really appreciate if someone could help me on this one. I'm not that into coding (yet)...

//peej

#3
peej

    PrestaShop Newbie

  • Members
  • Pip
  • 24 posts

From 1231420689:

I just discovered that if i make a custom stock message only in the ...when out of stock: field that it is not showing on the product info page. After i add a custom message in ....when in stock: then the out of stock message will show up.

Is that a bug?

Also i'd like to see in the custom message in the product listing, couse now if it is out of stock, and ordering the product is allowed on the product-listing it show: in stock, while there is no stock! Bug?

Is there anyone who knows a code solution to show up the custom ...when out of stock: text in the product listing?

Thanks in advanced.

Marco


Hi Marco,

I think I managed to fix it. You will have to change the following code in product-list.tpl:


{if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if}


into:


{if $product.quantity > 0}{$product.available_now|escape:'quotes':'UTF-8'}{else}{if $product.allow_oosp}{$product.available_later|escape:'quotes':'UTF-8'}{else}{l s='Out of stock'}{/if}{/if}


//peej

#4
msk69

    PrestaShop Apprentice

  • Members
  • PipPip
  • 403 posts
Hi Peej,

i'm sorry, i just read your reply.. :-(
I did test it, and quite seems to work, except when ordering is disabled if out of stock, then it does not show the text when it is expected.

Thanks!

Marco

#5
doigro

    PrestaShop Apprentice

  • Members
  • PipPip
  • 52 posts
Great! It works just fine!

#6
CameraTek

    PrestaShop Apprentice

  • Members
  • PipPip
  • 89 posts
Hi all,
This is how I've done it,
{if ($product.allow_oosp==0 OR $product.quantity > 0)}{l s='Available' mod='filtersearch'}{else}{l s='Back Order' mod='filtersearch'}{/if}

The code above shows "Available" when in stock and "Back Order" when there's 0 stock.
If your not using the filter search mod u need to delete mod='filtersearch' from the code.

What i would like to see is the available stock shown on the product list page, anyone know where the code is to pull the stock available.

Cheers
Andy
www.cameratek.co.uk
www.cameratekauctions.co.uk

#7
xiawa

    PrestaShop Newbie

  • Members
  • Pip
  • 14 posts
works perfectly, thanks!