Dar
Dar

Reputation: 169

How to filter if with 2 variables

I want to show some data if attribute_set is 1 and attributeText is Zero

AttributeSetId = 10 Attribute = myattribute, contain: Zero, One, Force

<?php if ($_product->getAttributeSetId() == "10"): && ($_product->getAttributeText('myattribute') == "Zero"):?> 

My data

<?php endif; ?>

What is wrong?

Any help is appreciated.

Resolved by myself :

<?php if ($_product->getAttributeSetId() == "10" && $_product->getAttributeText('myattribute') == "Zero"):?>

Upvotes: 1

Views: 99

Answers (1)

WackGet
WackGet

Reputation: 2916

Just some misplaced brackets.

<?php 
if ($_product->getAttributeSetId() == "10" && 
    $_product->getAttributeText('myattribute') == "Zero")  {
?>
My data
<?php } ?>

I prefer to use braces but you can use if/endif if you prefer.

Upvotes: 1

Related Questions