Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper out of stock messages #978

Open
Traumflug opened this issue Jun 27, 2019 · 2 comments
Open

Proper out of stock messages #978

Traumflug opened this issue Jun 27, 2019 · 2 comments
Assignees
Labels
Bug Theme Related to to one of the community themes

Comments

@Traumflug
Copy link
Contributor

See https://forum.thirtybees.com/topic/3160-out-of-stock-warning-not-showing-on-front-office-site-partial-fix-already/

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:

  • Check the translations to make sure there were words in the out of stock box, there were
  • Search the prestashop form, found this https://www.prestashop.com/forums/topic/250705-cannot-display-out-of-stock-or-custom-message/
  • 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)

@Traumflug Traumflug added the Bug label Aug 29, 2019
@ksimunovic ksimunovic self-assigned this Sep 6, 2019
@ksimunovic
Copy link
Collaborator

Try 2 is the right way to address this problem. It was all due to the CSS blocking the messages completely with !important and JS set show/hide status wasn't overwriting it. The same CSS rule is not present in community-theme-default.

@getdatakick Is there a reason why those messages were disabled with this commit? I'm not 100% sure that this change doesn't affect something else.

@getdatakick
Copy link
Contributor

@getdatakick Is there a reason why those messages were disabled with this commit? I'm not 100% sure that this change doesn't affect something else.

I'm not the author, I just grouped the changes and committed them to the git repository. You need to ask author of niara theme

@getdatakick getdatakick added the Theme Related to to one of the community themes label Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Theme Related to to one of the community themes
Projects
None yet
Development

No branches or pull requests

3 participants