How to check product visibility in product template



  • I want to check the product visibility in the product template (product.tpl). In product class there’s the variable $visibility which stores a string:

    /** @var string ENUM('both', 'catalog', 'search', 'none') front office visibility */
    public $visibility;
    

    And I’ve tried to access that variable directly fron product.tpl with no success. Is there a way to check if a class variable is passed to the controller? Or what do I need to do to have that variable available in the smarty template?

    Thanks in advance.



  • Thanks, Michael. I’m checking the string value like this, but it’s not rendering the p tag :S

    {if $product->visiblity == ‘both’}
    <p>visibility is both</p>
    {/if}



  • Oh, lol. Didn’t notice that one.

    Let’s mark this as solved then. I hope this is useful for somebody else.


 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.