vendredi 19 avril 2019

PHP: Do not display div is on certain category template

This is based on Magento 2, but realistically, this is an issue that could be the case for any website.

Having a situation where I only want a div to display on certain categories of my clients store. So I've been running a function like this:

<?php if($metal_type=="No") : ?>
    <div class="col-sm-2 col-md-3 col-lg-3 text-center product-sorter">
    </div>
<?php elseif ($is_hardware_category) : ?>
    <?php echo '' ?>
<?php endif;?>

I've also tried out

elseif($metal_type=="Yes")

for the elseif statement but in all cases, the div in question always appears. What can I do to make sure it doesn't? Seems the echo statement is not the right idea.

Aucun commentaire:

Enregistrer un commentaire