0

Below phtml returns comma separated values from [‘code’] How could I change the comma to a line break?

<?php foreach ($_additional as $_data): ?>
    <tr>

        <th class="col label" scope="row"><?= $block->escapeHtml(__($_data['label'])) ?></th>
        <td class="col data" data-th="<?= $block->escapeHtml(__($_data['label'])) ?>"><?= /* @escapeNotVerified */ 
        $_helper->productAttribute($_product, $_data['value'], $_data['code'])
        ?>
        </td>
    </tr>
<?php endforeach; ?>
Shaun
  • 23
  • 3
  • 2
    `str_replace(',', '
    ', $_data['code'])`?
    – Barmar Jun 29 '19 at 01:02
  • Hi Barmar, I have tried that but the page no longer opens. Maybe I am placing it in the wrong spot? – Shaun Jun 29 '19 at 01:13
  • I don't know what `$_helper->productAttribute()` does. – Barmar Jun 29 '19 at 01:15
  • Your question should show what you tried. I'm suggesting that you simple replace `$_data['code']` with that expression. – Barmar Jun 29 '19 at 01:16
  • Below is what I have tried $_helper->productAttribute($_product, $_data['value'], str_replace(',', '
    ', $_data['code']))
    – Shaun Jun 29 '19 at 01:46
  • That's what I was suggesting, so I don't know why that would cause your page not to open. See https://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php for how to enable full error reporting. – Barmar Jun 29 '19 at 05:04
  • Page is loading ok now but does not change any of the data. Its got me stumped! – Shaun Jun 29 '19 at 10:37
  • It looks like you're using some kind of framework or library. If you tag the question properly, it might attract people familiar with it. – Barmar Jun 29 '19 at 14:49

0 Answers0