Jump to content

Display an unavailable banner instead of the cart link


Serge94

Recommended Posts

Hello
I have been trying for three days to display an "unavailable" banner instead of the "add to cart" button under certain conditions all linked to the "available for sale", "display price" and "web exclusivity" checkboxes. products.
This banner must be displayed if only the box display the price is checked (with the price), only the box "excluded web" is checked (without the price), the two boxes "display the price" and "excluded web" are checked (with the price) and when none of the three boxes are checked (without the price)
I get it to work fine for the first three, but can't get it to work for the last.
The product page is not in catalog mode, the version of ps is 1.6.22
Here is the code I (painfully) generated:

{if (((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order) || (isset($product.online_only) && $product.online_only)))}
                    {if (($product.available_for_order == 0) || ($product.show_price == 0) || (($product.show_price == 0) && ($product.online_only == 0)) || (($product.available_for_order == 0) && ($product.show_price == 0) && ($product.online_only != 0)))}
<span class="indispo-list" style="background-color: #ff0000;color: #ffffff;font-size: 1.3em;font-weight: 600;padding: 8px;">{l s='Indisponible'}</span>
                                {elseif (($product.available_for_order == 0) && ($product.show_price == 0) && ($product.online_only == 0))}
<span class="indispo-list" style="background-color: #ff0000;color: #ffffff;font-size: 1.3em;font-weight: 600;padding: 8px;">{l s='Indisponible'}</span>                                
                    {else}
                    <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&amp;id_product={$product.id_product|intval}&amp;token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
                                        <span>{l s='Add to cart'}</span>
                                    </a>


Thank you in advance for your replies
Serge

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