Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
annafjmorris

"Out of stock" warning not showing on front office site - partial fix already

Question

Hi, on my store "Out of stock" was not showing when an item was out of stock (and back ordering is disabled for that product). It would just grey out the add to cart button. I did the following:

  1. Check the translations to make sure there were words in the out of stock box, there were
  2. Search the prestashop form, found this https://www.prestashop.com/forums/topic/250705-cannot-display-out-of-stock-or-custom-message/
  3. I replaced the following lines in my theme product.tpl
  <p id="product-availability">
          {if ($display_qties == 1 && !$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && $product->available_for_order)}
          <span id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
            <span id="quantityAvailable">{$product->quantity|intval}</span>
            <span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item'}</span>
            <span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items'}</span>
          </span>
          {/if}

          <span id="availability_statut"{if !$PS_STOCK_MANAGEMENT || ($product->quantity <= 0 && !$product->available_later && $allow_oosp) || ($product->quantity > 0 && !$product->available_now) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
            {*<span id="availability_label"><b>{l s='Availability:'}<b></span>*}
            {*<span id="availability_value" class="label{if $product->quantity <= 0 && !$allow_oosp} label-danger{elseif $product->quantity <= 0} label-warning{else} label-success{/if}">{if $product->quantity <= 0}{if $PS_STOCK_MANAGEMENT && $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{elseif $PS_STOCK_MANAGEMENT}{$product->available_now}{/if}</span>*}
          </span>

with the following from the default theme:

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

And now:

!Availability: This product is no longer in stock with those attributes but is available with others."

will show on a page with one of out stock item (where others are in stock) currently https://www.ethicalpets.co.uk/becotray#/45-colour-baby_blue blue colour litter trays

What I need now is:

  1. Is the change I made okay? I know almost nothing about css and html
  2. Can I move the text to the beige box above add to cart? This is more obvious for my elderly customers - I tried pasting it above the php for add to cart etc but it didn't display
  3. Where can I change this text? I can't find it in translations or in the tpl file, no idea where it comes from!

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

I'm not sure right now.
The heat here makes us ko.
Did you install and set up the module "mailalerts"?
Do you need the AEUC module for your shop?

If all settings are ok, there should not be any problems.

Share this post


Link to post
Share on other sites
  • 0
59 minutes ago, Traumflug said:

Hi, yeah I didn't do a bug report because I was pretty sure it's a mistake my theme designer made, but happy to work with a bug report if you suspect otherwise. Thanks, my GitHub name is annafjmorris I think, or Gingerling design.

12 hours ago, colorful-ant said:

I'm not sure right now.
The heat here makes us ko.
Did you install and set up the module "mailalerts"?
Do you need the AEUC module for your shop?

If all settings are ok, there should not be any problems.

I am pretty sure this is a theme issue rather than a settings issue as it was okay before we had a new theme and we didn't change the settings. Also tweaking the theme file and getting a result indicates to me it is the theme causing the issue. Thanks though! I will check out the things you talk about.

Share this post


Link to post
Share on other sites
  • 0

The main thing is can anyone check if the change I made to my theme is okay? I made a change before which stopped google reading the site cause of a missing close tag or something, and it cost me a ton of money, so I would really appreciate a second opinion!

Share this post


Link to post
Share on other sites
  • 0

Well it's hard to say. The code looks well formatted. But it's your site. You are the one, who can check if everything works as it should!?

Share this post


Link to post
Share on other sites
  • 0

You would think, but whatever I did last time was totally invisible to me, it all looked and worked fine, but due to an error in the code, google could only see the top half of my site. It took me months to realize there was a problem, I only realised becuase site traffic dropped off so much for so long I knew something must be wrong somewhere and asked people to check for me.

Thanks for checking, I am re-assured!

Share this post


Link to post
Share on other sites
  • 0

If it's just about syntax, there are HTML validators, like

https://validator.w3.org/nu/?doc=https%3A%2F%2Ffront.thirtybees.com%2F

Even the default theme isn't entirely free of warnings, still you can look up whether your theme shows more glitches.

Share this post


Link to post
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

×