C
C
CREV2018-03-16 19:50:23
opencart
CREV, 2018-03-16 19:50:23

How to fix instagram widget opencart2 error?

In general, such notices on the main page, I can’t imagine how to win, the teapot is still the same, but I really want insta to be on the site

Notice: Undefined index: user in /home/сайт/public_html/catalog/view/theme/тема/template/тема/revsocvinsta.tpl on line 3
Notice: Undefined index: user in /home/сайт/catalog/view/theme/тема/template/тема/revsocvinsta.tpl on line 6Warning: Invalid argument supplied for foreach() in /home/сайт/public_html/catalog/view/theme/тема/template/тема/revsocvinsta.tpl on line 6

Insta widget tpl file code
<div class="module-instagram" style="width:<?php echo $width; ?>px">
    <div class="main">
        <?php if (!$userInfo['user']['is_private']) { ?>
        <div class="images">
            <?php $i=0; ?>
            <?php foreach ($userInfo['user']['media']['nodes'] as $image) { ?>
            <?php $i++; if ($i==10) break; ?>
            <a href="https://www.instagram.com/p/<?= $image['code'] ?>/" target="_blank">
                <img src="<?= $image['thumbnail_src'] ?>" class="img-responsive" alt="" />
            </a>
            <?php } ?>
        </div>
        <?php } ?>
    </div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-03-16
@sidni

<?php if (isset($userInfo['user']['media']['nodes']) && is_array($userInfo['user']['media']['nodes']) && count($userInfo['user']['media']['nodes'])>0) { ?>
<?php foreach ($userInfo['user']['media']['nodes'] as $image) { ?>
            <?php $i++; if ($i==10) break; ?>
            <a href="https://www.instagram.com/p/<?= $image['code'] ?>/" target="_blank">
                <img src="<?= $image['thumbnail_src'] ?>" class="img-responsive" alt="" />
            </a>
            <?php } ?>
<?php } ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question