andref Posted September 1, 2017 Share Posted September 1, 2017 (edited) Hello there, I'm trying to achive the following: On the availability options of my products, I have some text that displays when the product is in stock and is available to order, and some text on other products to display when there is out of stock but is available to order, both set in the product back office options. What I want is to display some text when neither of the two fields have text to display, I'm doing this in the product.tpl and have the following code: <div> <p 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">{l s='Availability:'}</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} {if !isset($product->available_now)} {l s='Envio Imediato'} {else} {$product->available_now} {/if} {/if}</span> </p> </div> I've modified a bit of the template code to acommodate my condition but it doens't work! I've tried a few diferent ways but with no luck, all the other "normal" label display correctly but not my text, it seems that it isn't checking if the $product->available_now is empty or not... If someone have any ideas I would really appreciate it! Thank You. Edited September 1, 2017 by andref (see edit history) Link to comment Share on other sites More sharing options...
hakeryk2 Posted September 4, 2017 Share Posted September 4, 2017 I don't realy get what You want to achieve but !isset(!isset($product->available_now) will propably not work because this var is set all the time, better try $product->available_now == 0 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now