1

I want to get all attributes of a product which start with "wdb_" in custom tab.

For this, I am getting each attribute manually.

For example: wdb_carat, wdb_info, wdb_clarity etc...

My Code is:

<?php $product = $block->getProduct(); ?> 
<div class="diamond-information">
    <ul class="diamond-info">
        <?php if($product->getWdbMinimumCaratWeight()){?>
            <li class="carat-weight">
                    <h5>Carat:     </h5>
                    <span>
                        <?php echo $product->getWdbMinimumCaratWeight(); ?>
                    </span>
            </li>
        <?php } ?>
        <?php if($product->getWdbAverageClarity()){?>
            <li class="average-clarity">
                    <h5>Clarity:     </h5>
                    <span>
                        <?php echo $product->getWdbAverageClarity(); ?>
                    </span>
            </li>
        <?php } ?>
        <?php if($product->getWdbAverageColor()){?>
            <li class="average-color">
                    <h5>Color:     </h5>
                    <span>
                        <?php echo $product->getWdbAverageColor(); ?>
                    </span>
            </li>       
        <?php } ?>
        <?php if($product->getWdbCut()){?>
            <li class="average-cut">
                <h5>Cut:     </h5>
                <span>
                    <?php echo $product->getWdbCut(); ?>
                </span>
            </li>       
        <?php } ?>
        <?php if($product->getWdbShape()){?>        
            <li class="average-cut">
                    <h5>Shape:     </h5>
                    <span>
                        <?php echo $product->getWdbShape(); ?>
                    </span>
            </li>
    <?php } ?>
    </ul>
</div>

I don't want to get each attribute manually.

Can anyone help me to do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.