Jump to content

Display Availability in Product Page


Eowyn_86

Recommended Posts

Hi,

 

First of all, sorry for my english, it's a little bit bad, but I will try to explain my problem the best I can.

 

I have a shop with a lot of products, all of them with stock 0. I don't want to change that, because my supplier doesn't provide me with that information. I only know if there is stock or not. In case of there is no stock, I have the date when product arrives.

 

So, my intention is put "Stock / No Stock" on the box Available Now, and the date on the box Available Later.

 

Here comes the problem. Prestashop understands that if the stock is 0, the product isn't available, for consecuence, the text on Available Now doesn't appear. Doesn't even appear the text "Availability:" on the page product. I'll show you an image:

 

sinttulo1igu.jpg

 

I want that in the page product appears the next:

 

In case of stock

Availability: Stock

 

In case of no stock

Availability: No Stock - Approximate date: 20/07/2013

 

 

How I can change the code of product.tpl to make that possible? Do I have to change only product.tpl or another one too?

 

My Prestashop version is 1.4.7.

 

 

Thanks in advance!! =)

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

It depends from your Prestashop version and theme.

So in 1.5 in Product back office on Quantity tab you can make settings like this



so in front office on default theme it shows



Code for it is in product.tpl


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

<p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>

<span id="availability_date_label">{l s='Availability date:'}</span>

<span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>

</p>

but maybe it is removed from your theme or hidden with css.

 

Edited by razaro (see edit history)
  • Like 2
Link to comment
Share on other sites

Hi razaro, thanks for answering!

 

My Prestashop version is 1.4.7 and there is no way to make it work. Some time ago, I tried to modify the code on product.tpl, and it worked. But it was on the 1.5.3 version. I don't know if that may be the problem...

 

This is the code:

 

<p id="availability_statut"
{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp)}
style="display:block;"
{/if}>

<span id="availability_label">
{l s='Availability:'}
{$product->available_now}
</span>
<span id="availability_value"
{if $product->quantity <= 0}
class="warning_inline"
{/if}>
{if $product->quantity <= 0 && $allow_oosp}
{if $product->available_later}
{l s='Fecha aproximada: '}{$product->available_later}
{/if}
{else}
{l s='This product is no longer in stock'}

{/if}
</span>
</p>

 

 

Any ideas?

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

OK for 1.4 version try this


<!-- availability -->

<p id="availability_statut" style="display:block;">

{if ($product->quantity > 0 && $product->available_now) && $product->available_for_order && !$PS_CATALOG_MODE}

<span id="availability_label">

{l s='Availability:'}

{$product->available_now}

</span>

{/if}

<span id="availability_value"

{if $product->quantity <= 0}

class="warning_inline"

{/if}>

{if $product->quantity <= 0 && $allow_oosp}

{if $product->available_later}

{l s='Availability date:'}{$product->available_later}

{/if}

{elseif $product->quantity <= 0 && !$allow_oosp}

{l s='This product is no longer in stock'}

{/if}

</span>

</p>

and settings for product in back office

 

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

I've done that exactly like you told me, but it doesn't work. It only appears the date, but not the label "Availability Date:". It seems to be that Prestashop ignores any code or any word or phrase that I put in there.

 

sinttulo1pi.jpg

Link to comment
Share on other sites

  • 1 month later...

Thanks for this, it works perfectly on my shop, however I would also like to use this on the product-list.tpl file but the code doesn't seem to work the same as in product.tpl. Any idea how I can get it to work on product-list.tpl as well?

 

Thanks for your help.

 

It depends from your Prestashop version and theme.

 

So in 1.5 in Product back office on Quantity tab you can make settings like this

 

 

 

so in front office on default theme it shows

 

 

 

Code for it is in product.tpl

  <!-- 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>
  <p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
<span id="availability_date_label">{l s='Availability date:'}</span>
<span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>
  </p>

 

but maybe it is removed from your theme or hidden with css.

Link to comment
Share on other sites

  • 5 weeks later...

Not sure I understand your problem, but in BO enable Allow purchases when the product is out of stock, it will allow the purchase and keep the warning and when available

 

I'm sorry you already tried that and it did not work

 

Success and good sales!

 

 

It's http://elbunkerz.com

 

And the product I'm checking is that one: http://elbunkerz.com...hp?id_product=7

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 months later...

Hello everyone. I would also like to have an approximate date of availability in my front office, but it only works when "Allow orders" is ticked in BO which I do not want. I'd like to have the same as in the 2nd pic in post No. 2 above, but I do not want my customers to be able to order, I just want them to have that information when the item is going to be available. 

Link to comment
Share on other sites

  • 4 months later...

It depends from your Prestashop version and theme.

 

So in 1.5 in Product back office on Quantity tab you can make settings like this

 

attachicon.gifimg1.JPG

 

so in front office on default theme it shows

 

attachicon.gifs2.JPG

 

Code for it is in product.tpl

   <!-- 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>
   <p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
	<span id="availability_date_label">{l s='Availability date:'}</span>
	<span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>
   </p>
but maybe it is removed from your theme or hidden with css.

 

It works perfect for me, but what IF i would like to add icon in product-list. Its icon to see which product have availability date.

 

I tryed this:

 

{elseif ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
<span class="pre-order_icon" title="{l s='Prekės išsiunčiamos'}{dateFormat date=$product->available_date full=false}
 
But i just got blank page in product page.
Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...
  • 4 months later...

I would like to know this as well.  I've got version 1.6:

so, whilst NOT allowing customer to order stock, display a date for that particular item. 

It must also work for combinations.  So Red XL would be one date, Blue XL another date etc.

 

OR

Just display a 'more stock due date' based on selection, regardless of whether there are still some in stock or not.

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