1

I have a situation where I need to display a product attribute that contains text phrases separated by semicolon. The goal is to replace the semicolon with a I can call up the attribute using the code below however I am stuck on how to do the replacement. I'm assuming a str_replace of some sort?

<?php echo $this->htmlEscape($_product->getData('attribute_id')); ?>

1 Answer 1

2

Lot's of ways of doing it. As you say str_replace should be simple enough, another alternative would be.

<?php echo $this->htmlEscape(implode('|', explode(';', $_product->getData('attribute_id')))); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.