1
  <div class="product-item-details">
                            <strong class="product-item-name">
                                <a title="<?= $block->escapeHtml($item->getName()) ?>"
                                   href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>"
                                   class="product-item-link">
                                    <?= $block->escapeHtml($item->getName()) ?>
                                </a>

I'm trying to use substr like this

substr($_helper->productAttribute($_product, $_product->getName() , 'name'),0,75)

But my code does not work correctly, it shows a 504 on product page.

Thanks

1 Answer 1

1

In your code, you are using $_product while in the code you pasted product seems to be $item

Try changing:

substr($_helper->productAttribute($_product, $_product->getName() , 'name'),0,75)

To

substr($_helper->productAttribute($item, $item->getName() , 'name'),0,75)

1
  • Thanks works perfectly
    – Mmanza
    Commented Sep 3, 2019 at 22:29

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.