Skip to content

How to add a new rule after getting an attribute?

I’m a beginner in PHP and magento and facing a little problem.

After getting an attribute in the catalog list, I want to add a new rule. But the new rule only needs to show after the attribute is “filled”.

I Tried this:

<?php /* @escapeNotVerified */ echo $_product->getResource()->getAttribute('bierstijl')- >getFrontend()->getValue($_product); echo "br";?>

But when I use this case it’s breaking always, also when there is no bierstijl attribute.

So it has to only break when there is an attribute bierstijl

Does anyone know a solution for this case?

Kind regards