Jump to content

Hide Stock Quantity


Recommended Posts

Hi there, hopefully there's a quick answer to this.
I've searched through the back office for hours and can't seem to find what I'm looking for.
Basically I want to either show "in stock" or "out of stock" instead of the quantity in stock.

I took a look at "Display last quantities when qty is lower than" Under Tools, Products and set it to 0 however this made no difference at all.

Is there some kind of option that I'm perhaps missing?


Thanks a lot in advance~

Link to comment
Share on other sites

Edit each of your products and on the "1. Info." tab, enter "In Stock" under "Displayed text when in-stock" and "Out of Stock" under "Displayed text when allowed to be back-ordered". I think that should work.

Link to comment
Share on other sites

I guess you'll have to modify code then. Try changing lines 264-270 of product.tpl in your theme's directory from:

<!-- availability -->

quantity == 0 && !$product->available_later) OR ($product->quantity != 0 && !$product->available_now)} style="display:none;"{/if}>
{l s='Availability:'}
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}




to:

<!-- availability -->


{l s='Availability:'}
quantity == 0} class="warning-inline"{/if}>
       {if $product->quantity == 0}{if $product->available_later}{$product->available_later}{else}{l s='Out of Stock'}{/if}{else}{if $product->available_now}{$product->available_now}{else}{l s='In Stock}{/if}{/if}




This code should display whatever you enter in the fields I mentioned in my previous post and "Out of Stock" or "In Stock" if you leave those fields blank.

Link to comment
Share on other sites

  • 2 weeks later...

Oour screenshots from the original post #1 are not showing now, so folks are starting to suggest what you have already done. When you take a screenshot off your server, it disappears here too.

Have you resolved the issue? If not, you might want to describe all the settings you have made related to this (instead of the screenshots), that way the thread will be more complete for folks to help you now, and for those in the future who encounter a similar problem.

Link to comment
Share on other sites

  • 3 months later...

hi rocky,

i'm using the theme fennecs, the product.tpl looks different from your example (see excerpt below). can you please help me how i should modify the themes/fennecs/product.tpl?

<!-- availability -->

quantity == 0 && !$product->available_later) || (!$product->available_now && $display_qties != 1) } style="display:none;"{/if}>
{l s='Availability:'} 




in the attachment you can find the complete product.tpl file

thanks!

Link to comment
Share on other sites

hi rocky,

thx for your quick reply. however, the number of items in stock are still visible. and when there are no items in stock, it displays only "availabilty" with an empty value.
i just want to show either "in stock" or "out of stock" (like the original request of this post) and remove the "warning: last items in stock!"

thx again for your help!

Link to comment
Share on other sites

Try changing the code to:

<!-- availability -->


{l s='Availability:'}
quantity == 0} class="warning-inline"{/if}>
       {if $product->quantity == 0}{if $product->available_later}{$product->available_later}{else}{l s='Out of Stock'}{/if}{else}{if $product->available_now}{$product->available_now}{else}{l s='In Stock}{/if}{/if}




and go to Preferences > Products and change "Display last quantities when qty is lower than" to 0, then click Save at the bottom.

Link to comment
Share on other sites

i've changed the code, but now the entire product page won't load. i've attached the modified products.tpl can you have a look what i've done wrong?

current settings in Preferences-Products:

Display available quantities on product page: no
Display last quantities when qty is lower than: 0

Link to comment
Share on other sites

strange, i can't upload any attachments. i've the following with the products.tpl file:

changed:

<!-- availability -->

quantity == 0 && !$product->available_later) || (!$product->available_now && $display_qties != 1) } style="display:none;"{/if}>
{l s='Availability:'} 





to your suggestion. resulted in blank product page.

Link to comment
Share on other sites

  • 2 years later...

totaly messed up and only thing did was try change code, even after save it back to the original code, no content is displayed in the product page. this is total disaster.

 

hello, this is old topic (from 2010) things have changed since then - especially in 1.5 version

so please open new thread with your issues or questions, don't continue discussion here because solution above is for OLD prestahop versions

Link to comment
Share on other sites

×
×
  • Create New...