0

I'm try to add a banner image to the list.phtml, but it's not displaying.

This is what i did:

step 1: copied /public_html/vendor/mirasvit/module-rewards/src/RewardsCustomerAccount/view/frontend/templates/account/list.phtml

into

/public_html/app/design/frontend/Infortis/ultimo/Mirasvit_RewardsCustomerAccount/templates/account/list.phtml

step2: upload the image to /public_html/app/design/frontend/Infortis/ultimo/web/images/membership-banner.jpg

step 3: modify the list.phtml as below

<?php
/** @var \Mirasvit\RewardsCustomerAccount\Block\Account\Listing $block */
$collection = $block->getTransactionCollection();
$earnRules = $block->getDisplayEarnRules();
$spendRules = $block->getDisplaySpendRules();
?>
<div class="block block-rewards-account-summary order-details-items">
    <div class="block-title">
        <?= $block->getChildHtml('rewards.page.main.title'); ?>
        <strong><?= __('Points Summary') ?></strong>
    </div>

    <div class="block-content">
        <p><?= __('You have <b>%1</b> in your account.', $this->helper('Mirasvit\Rewards\Helper\Data')->formatPoints($block->getBalancePoints())); ?></p>
        <p><?= $block->getChildHtml('rewards.notification') ?></p>
        <p><?= __('test.'); ?> </p>
    </div>
    
    <!--adding this part trying to display the image-->
    <div class="block-content"> 
        <img src='<?php echo $this->getViewFileUrl('Infortis_Ultimo::images/membership-banner.jpg'); ?>' alt="membership-banner" width="1150" height="325">
    </div>


</div>

step 4: run php bin/magento s:s:d; php bin/magento c:f but nothing changes on the frontend.

1 Answer 1

0

As you have put your image in theme web folder public_html/app/design/frontend/Infortis/ultimo/web/ so you have to use

$block->getViewFileUrl('images/membership-banner.jpg')

instead of $this->getViewFileUrl('Infortis_Ultimo::images/membership-banner.jpg').

When you have use Infortis_Ultimo:: it indicated that folder is public_html/app/design/frontend/Infortis/ultimo/Infortis/Ultimo/web.

1
  • i changed it to <div class="block-content"> <img src='<?php echo $block->getViewFileUrl('images/membership-banner.jpg'); ?>' alt="banner" width="1150" height="325"> </div> but still not showing up. basically, even if i add some simple text it doesn't show up. do you have any ideas? Jan 9, 2021 at 7:58

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.