Jump to content
thirty bees forum
  • 0

Theme Button Popup Notices


Obi

Question

I have a child theme I'm trying to complete based on the community theme and I am trying to disable the ability for a visitor to click on an out of stock button that does not have the disabled selector - but what I am getting is an unstyled popup that says "This product is no longer available." I can't find where this behavior is happening but I want to disable it only for  buttons styled with certain selectors. Any ideas?

Below is a screenshot of two of the button types that even though the cursor is changed to "not-allowed" (via disabled selector), clicking the button still triggers the popup shown in the image:

image.png.faf2c633ebf5acfa7f1ee831d51a1f45.png

Thanks!

 

Edited by Obi
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Well... since I can't edit the original post - here is the button-container code that produces that part of the product display block in product-list-item.tpl:

                <div class="button-container">
                    <a class="btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}">
                        <span>{if (isset($product.customization_required) && $product.customization_required)}{l s='Customize'}{else}{l s='More'}{/if}</span>
                    </a>
                    {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE}
                        {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}
                            {capture}add=1&amp;id_product={$product.id_product|intval}{if isset($product.id_product_attribute) && $product.id_product_attribute}&amp;ipa={$product.id_product_attribute|intval}{/if}{if isset($static_token)}&amp;token={$static_token}{/if}{/capture}
                            <a class="ajax_add_to_cart_button btn btn-primary"
                               href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}"
                               rel="nofollow" title="{l s='Add to cart'}"
                               data-id-product-attribute="{$product.id_product_attribute|intval}"
                               data-id-product="{$product.id_product|intval}"
                               data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}">
                                <i class="icon icon-cart-plus"></i>
								<span>{l s='Add to cart'}</span>
                            </a>
						{* Following test added to display "discountinued" in place of stock quantity messages when item discontinued - see available_later - SDM *}
						{elseif (isset($product.available_later) && $product.available_later|stristr:"discontinued") }
							<div class="ajax_add_to_cart_button btn btn-primary disabled">
							<i class="icon icon-info-sign"></i>
							<span class="out-of-stock">{l s='Discontinued'}</span>
							</div>
						{* Following test added to display "out of print" in place of stock quantity messages when item discontinued by MFG - see available_later - SDM *}
						{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions < 1 && isset($product.available_later) && $product.available_later|stristr:"out of print") }
							<div class="ajax_add_to_cart_button btn btn-primary disabled">
							<i class="icon icon-eraser"></i>
							<span class="out-of-stock">{l s='Out of Print'}</span>
							</div>
						{* Following test added to display "coming soon" in place of stock quantity messages when item is not yet available - see available_later - SDM *}
						{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions < 1 && isset($product.available_later) && $product.available_later|stristr:"coming soon") }
							<div class="ajax_add_to_cart_button coming-soon btn btn-primary">
							<i class="icon icon-time"></i>
							<span class="coming-soon">{l s='Coming Soon'}</span>
							</div>
                        {else}
						{* product is simply out of stock - SDM *}
							<div class="ajax_add_to_cart_button btn btn-primary disabled">
								<span class="oos">{l s='Out of Stock'}</span>
							</div>
                        {/if}
                    {/if}
                </div>
            </div>

 

Link to comment
Share on other sites

  • 0
4 hours ago, yaniv14 said:

try removing "ajax_add_to_cart_button" class, because there is a click event bind to this class

That was it - Thank You!!!

A few style changes and back on the road to my new theme!

image.thumb.png.a6bbf0a23a3800a2654d85c64542ab2d.png

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