Jump to content

How to hide "Availability: X items in stock" from user?


Recommended Posts

{* Comment out *} the following section of product.tpl in your theme's directory:

<!-- availability -->

quantity == 0 && !$product->available_later) || (!$product->available_now && $display_qties != 1) } 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}


Link to comment
Share on other sites

I got it.
I also commented next paragraph.
So, the final state should be:


<!-- availability 

quantity == 0 && !$product->available_later) || (!$product->available_now && $display_qties != 1) } 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}


-->


<!-- number of item in stock 

quantity == 0)} style="display:none;"{/if}>
{$product->quantity|intval}
quantity > 1} style="display:none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}
quantity < 2} style="display:none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}


-->



Thanks again.

Link to comment
Share on other sites

  • 2 weeks later...

Hi
I tried to comment out the bit that rocky said and uploaded it and now i'm getting:


Fatal error: Smarty error: [in /usr/local/pem/vhosts/109861/webspace/httpdocs/boogtique/store/themes/ipnotik/product.tpl line 214]: syntax error: invalid attribute name: '*' (Smarty_Compiler.class.php, line 1550) in /usr/local/pem/vhosts/109861/webspace/httpdocs/boogtique/store/tools/smarty/Smarty.class.php on line 1095


I have uncommented it and i still get it!
The store has to go live in the next few days!!!!!!

Heeelp!
Link to comment
Share on other sites

The error message says to check line 214 of themes/ipnotik/product.tpl. Look for any * on this line, which is causing the problem. If you can't figure out the problem, just replace that line or file with the one from the original ipnotik theme.

Link to comment
Share on other sites

  • 2 months later...
Replace lines 271-273 of product.tpl with:

{if $product->quantity <= 0}{l s='Item not available'}{elseif $product->quantity < 10}{l s='Only'} {$product->quantity} {l s='items left'} {else}{l s='Item available'}{/if}



Hi Rocky,

With all the changes that one does to the code as suggested above for this example, my questions is:

- How does if get affected when you upgrade say from 1.2.5 to 1.3?

- Do you have to keep track of these changes and make the changes again once you upgrade or does the upgrade process track and make changes for you if any of this code is to be overwritten?
++++++++++
ALSO second of the question,

Why would one change code when some of these things can be done through back office, specially for a newbie like me. I would rather not touch the code too much if I can avoid it?
Link to comment
Share on other sites

You must keep track of all the changes you do, since overwriting your modified v1.2.5 files with the v1.3 files will overwrite the changes you made. You will have to make those changes once again after installing v1.3.

It is better to do things through the Back Office than to modify code. If you can find a way to do something through the Back Office, then do that. Unfortunately, there are many things that can't be done through the Back Office and so require code changes.

Link to comment
Share on other sites

  • 1 month later...

I am also having problems with removing the Availability display. I have gone into the Preferences/Products and checked No for Display available quantities but it continues to display in all browsers. I am using the Uppercase theme.

Link to comment
Share on other sites

  • 4 years later...

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