Jump to content

disable out of stock products


Recommended Posts

Yes there is. Look in the back office under the Preferences and then the Products sub-tab (link). There are a few options on that page for what to do with out of stock products, as well as other things.

BTW I just answered this exact same question about 3hrs ago so next time please use the search feature first before asking.

F

Link to comment
Share on other sites

Yes there is. Look in the back office under the Preferences and then the Products sub-tab (link). There are a few options on that page for what to do with out of stock products, as well as other things.

BTW I just answered this exact same question about 3hrs ago so next time please use the search feature first before asking.

F


I see no options to hide the products that are not in stock. The only similar one that I see is "Display unavailable product attributes on product page:".

Also, I did a few google searches with "site:prestashop.com" and they returned no helpful results.
Link to comment
Share on other sites

I see no options to hide the products that are not in stock. The only similar one that I see is "Display unavailable product attributes on product page:".

Also, I did a few google searches with "site:prestashop.com" and they returned no helpful results.


using the search for this forum:
http://www.prestashop.com/forums/search_results/14575b87d9f9b973ca1165a94ac70737/

One of those results should have what you're looking for

f
Link to comment
Share on other sites

  • 3 weeks later...

I have the same problem as Ktross.
There is no such option in Prestashop, this needs to be a custom hack (and it will not be 'clean' it is going to override some stock management parameters from PS).
I have found a french post about this here (i'm french): http://www.prestashop.com/forums/viewthread/1894/developpement_et_modules/non_affichage_des_produits_a_stock_0

But the code given did not work on my version 1.2.5.
I think a lot of people are looking for this hack, so if anyone suceeded, please post the answer. Thanks.

Link to comment
Share on other sites

Edit product-list.tpl and change

this..

>
{if isset($products)}
   <!-- Products list -->
</pre>
<ul>
   {foreach from=$products item=product name=products}


{if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if}
getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />
{if $product.new == 1}{l s='new'}{/if}{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}

{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}


               {if $product.on_sale}
{l s='On sale!'}
               {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}
{l s='Price lowered!'}
               {/if}
               {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if}
               {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if}
               {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}
{l s='Add to cart'}
               {else}
{l s='Add to cart'}
               {/if}
{l s='View'}




   {/foreach}
</ul>
<br>   <!-- /Products list --><br>{/if



to this..

>

{if isset($products)}
   <!-- Products list -->
</pre>
<ul>
   {foreach from=$products item=product name=products}
   {if ($product.allow_oosp OR $product.quantity > 0)}


getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />
{if $product.new == 1}{l s='new'}{/if}{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}

{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}


               {if $product.on_sale}
{l s='On sale!'}
               {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}
{l s='Price lowered!'}
               {/if}
               {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if}
               {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if}
               {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}
{l s='Add to cart'}
               {else}
{l s='Add to cart'}
               {/if}
{l s='View'}




       {else}{/if}
   {/foreach}
</ul>
<br>   <!-- /Products list --><br>{/if}<br

Link to comment
Share on other sites

Hi Robert
Thanks for your answer. I've just tried it and it seems to be working, but i am having a problem with the product pictures not being diplayed.

Originally i had this in my products-list.tpl:

getImageLink($product.link_rewrite, $product.id_image, 'home')}



and your code replaces it with this:

getImageLink($product.link_rewrite, $product.id_image, 'home')}"



This causes the pics not to display on firefox or IE. i'm not sure how to fix the code though ;)
Also i noticed the product count at the top is not updated, so it could be showing x items while there is none displayed.

16446_rulsg5aOBwnHT5up4ZBT_t

Link to comment
Share on other sites

Hey Duffman,

Hmm, i dont seem to have any issues with images at all, did the images come up before?
I dont see any difference between the code you are providing and the code that i provided..

I removed the x products part of the page to simplify the layout, so i guess this doesn't affect me.

Not sure i can help with that.

Cheers

Link to comment
Share on other sites

Hi Robert

I managed to fix the image tag.
Find below my working product-lis.tpl file:

>{if isset($products)}
   <!-- Products list -->
</pre>
<ul>
   {foreach from=$products item=product name=products}
   {if ($product.allow_oosp OR $product.quantity > 0)}


getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />
{if $product.new == 1}{l s='new'}{/if}{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}

{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}


               {if $product.on_sale}
{l s='On sale!'}
               {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}
{l s='Price lowered!'}
               {/if}
               {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if}
               {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if}
{l s='View'}




       {else}{/if}
   {/foreach}
</ul>
<br>   <!-- /Products list --><br>



This code contains two hacks:
1) It does not display article where Qty= 0
2) It does not display the 'Add to Cart' button on the product list page.

Link to comment
Share on other sites

Hey Duffman,

Hmm, i dont seem to have any issues with images at all, did the images come up before?
I dont see any difference between the code you are providing and the code that i provided..

I removed the x products part of the page to simplify the layout, so i guess this doesn't affect me.

Not sure i can help with that.

Cheers


yes i figured the two codes i copied in my previous posy were identical but when i try to edit the post to change the code, it don't seem to take the change. Weird.
Anyway you can view the code is used in my new post.
[EDIT] Damn it changed it in my new post too. See attached pic.
Thanks.
Antoine

16472_5EWmgIiNUU1hRm2KRxkU_t

Link to comment
Share on other sites

  • 1 month later...

I am using a theme so my product-list.tpl looks different than the one mentioned above. Can anyone help me out with the same issue?



   {$category->name|escape:'htmlall':'UTF-8'}
   {if $products}
       {include file=$tpl_dir./product-sort.tpl}
   {/if}

{$HOOK_LEFT_COLUMN}

   {if isset($products) AND $products}
        {assign var='liHeight' value=360}
        {assign var='nbItemsPerLine' value=4}
        {assign var='nbLi' value=$products|@count}
        {assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil}
        {assign var='ulHeight' value=$nbLines*$liHeight}

           {foreach from=$products item=product name=products}
           {assign var='productLink' value=$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)}

  
{$product.name|truncate:30|escape:'htmlall':'UTF-8'}{if $product.new == 1}{l s='new'}{/if}
             <!-- Original Code

{displayWtPrice p=$product.price}{l s='View'}
             -->
             <!-- MY NEW CODE -->

{if $product.price_without_reduction != $product.price}{displayWtPrice p=$product.price_without_reduction}SALE! {/if}{displayWtPrice p=$product.price}{l s='View'}
             <!-- {l s='Cart'}-->





            {/foreach}

       {else}

{l s='No featured products' mod='homefeatured'}
   {/if}

   <!-- Pagination -->
   {include file=$tpl_dir./pagination.tpl}

<!-- /MODULE Home Featured Products -->


Link to comment
Share on other sites

  • 7 months later...
  • 1 year later...

 

yes i figured the two codes i copied in my previous posy were identical but when i try to edit the post to change the code, it don't seem to take the change. Weird.

Anyway you can view the <img /> code is used in my new post.

[EDIT] Damn it changed it in my new post too. See attached pic.

Thanks.

Antoine

 

Duffman,

 

How can we update this code that it also works when you have two or more attibutes in the product that still have stock.

With the code above the product dissapears when the leading attribute has no stock. But also dissapears when an extra attribute (not leading) still has stock.

 

Can you please help.

 

grolarja

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