0

I am still fairly new to Magento and it's structure.

I have two custom PHTML files that show Featured & News products (one file) and recent Wordpress posts (second file). I had them in the /dev/app/design/frontend/base/default/template/page/html directory which I have discovered is the core template location and could eventually be effected by a Magento update. They did load just fine when in this directory.

I moved them to my custom template directory (/dev/app/design/frontend/default/rics/template/page/html [rics being the name of our template]) and now they do not load.

These are being called in the default home page which is a CMS page in the Magento system. This is the block code that calls these pages,

{{block type="layerslider/layerslider" name="layerslider" template="layerslider/layerslider.phtml"}}

{{block type="core/template" template="page/html/featurednewproducts.phtml"}}

{{block type="core/template" template="page/html/newsrecentposts.phtml"}} 

Here is the link to our development site - http://dev.flymasters.cliquecode.com/

The layerslider loads fine but the Featured & New products as well as the Recent News post do not load.

I am thinking it might be in the block "type" I have specified but am not certain.

If you need anymore information or code let me know.

I assume you mean the code of the two PHTML files. Here they are.

This is the Featured and New Products file (featurednewproducts.phtml)

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * @deprecated  after 1.4.0.0-alpha3
 */

/**
 * This template is for generic wrapper purposes, including ajax.updater loaded blocks
 *
 * Usage in layout xml files:
 * <block type="core/template" template="page/html/wrapper.phtml">
 *    <action method="setId"><id>some-custom-identificator</id></action>
 *
 *    <!-- optional -->
 *    <action method="setTag"><tag>span</tag></action> <!-- div is used if not specified -->
 *    <action method="setParams"><params>class="custom-class"</params></action>
 *
 *    <!-- insert wrapped blocks here -->
 * </block>
 */
?>
<div class="home-tabs-content">
    <div class="home-tabs">
        <div class="home-tabs-nav-wrapper">
            <ul class="tabs-nav">
                <li class="tab-nav active" data-toid="1">Featured Products</li>
                <li class="tab-nav" data-toid="2">New Products</li>
            </ul>
        </div>
        <div class="tabs-content-wrapper">
            <div class="content-tab active" id='tab1' style="background-color:#fff !important;">
                <?php
                $fCat = Mage::getModel('catalog/category')->load(126);
                $fProducts = $fCat->getProductCollection()->setPageSize(4)->setCurPage(1)->addAttributeToSelect('*')->addAttributeToSort('created_at', 'desc');
                if(count($fProducts) > 0):
                    ?>
                    <a href="/featured.html" class="view-all">View All Featured Items</a>
                    <ul class="tabs-products-ul">
                        <?php
                        foreach($fProducts as $fProduct):
                            ?>
                            <li class="products-li">
                                <div class="products-li-content-wrapper"><?php //echo $this->getSkinUrl('images/item1.jpg') ?>
                                    <div class="products-li-img-wrapper"><a href="<?= $fProduct->getUrlPath(); ?>"><img src="<?= $fProduct->getImageUrl(); ?>" class="products-li-img"/></a></div>
                                    <div class="products-li-content">
                                        <p class="products-li-title"><a href="<?= $fProduct->getUrlPath(); ?>" class="products-li-title"><?= $fProduct->getName(); ?></d></p>
                                        <p class="products-li-price" class="products-li-title"><?= Mage::helper('core')->currency($fProduct->getPrice()); ?></p>
                                        <a href="<?= $fProduct->getUrlPath(); ?>" class="products-li-link">VIEW</a>
                                    </div>
                                </div>
                            </li>
                            <?php
                        endforeach;
                        ?>
                    </ul>
                    <?php
                endif;
                ?>
            </div>
            <div class="content-tab" id='tab2' style="background-color:#fff !important;">
                <?php
                $nCat = Mage::getModel('catalog/category')->load(127);
                $nProducts = $nCat->getProductCollection()->setPageSize(4)->setCurPage(1)->addAttributeToSelect('*')->addAttributeToSort('created_at', 'desc');
                if(count($nProducts) > 0):
                    ?>
                    <a href="/new.html" class="view-all">View All New Items</a>
                    <ul class="tabs-products-ul">
                        <?php
                        foreach($nProducts as $nProduct):
                            ?>
                            <li class="products-li">
                                <div class="products-li-content-wrapper"><?php //echo $this->getSkinUrl('images/item1.jpg') ?>
                                    <div class="products-li-img-wrapper"><a href="<?= $nProduct->getUrlPath(); ?>"><img src="<?= $nProduct->getImageUrl(); ?>" class="products-li-img"/></a></div>
                                    <div class="products-li-content">
                                        <p class="products-li-title"><a href="<?= $nProduct->getUrlPath(); ?>" class="products-li-title"><?= $nProduct->getName(); ?></a></p>
                                        <p class="products-li-price" class="products-li-title"><?= Mage::helper('core')->currency($nProduct->getPrice()); ?></p>
                                        <a href="<?= $nProduct->getUrlPath(); ?>" class="products-li-link">VIEW</a>
                                    </div>
                                </div>
                            </li>
                            <?php
                        endforeach;
                        ?>
                    </ul>
                    <?php
                endif;
                ?>
            </div>
        </div>
    </div>
</div>

Here is the Recent blog post file (newsrecentposts.phtml)

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * @deprecated  after 1.4.0.0-alpha3
 */

/**
 * This template is for generic wrapper purposes, including ajax.updater loaded blocks
 *
 * Usage in layout xml files:
 * <block type="core/template" template="page/html/wrapper.phtml">
 *    <action method="setId"><id>some-custom-identificator</id></action>
 *
 *    <!-- optional -->
 *    <action method="setTag"><tag>span</tag></action> <!-- div is used if not specified -->
 *    <action method="setParams"><params>class="custom-class"</params></action>
 *
 *    <!-- insert wrapped blocks here -->
 * </block>
 */
?>
<div class="home-tabs-content">
    <div class="home-tabs"> 
        <div class="home-news-wrapper">
            <div class="home-news-block">

                <div class="col-sm-3 news-image-left-link-wrapper">
                    <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/html/lefthandlinks.phtml')->toHtml(); ?>
                </div>


                <div class="col-sm-9 news-content-wrapper">
                    <div>
                        <h2 class="home-news">Latest News</h2>
                    </div>
                <?php       
                    $posts = Mage::getResourceModel('wordpress/post_collection')->addPostTypeFilter('post')
                        ->addIsViewableFilter()
                        ->addCategoryIdFilter(3)
                        ->setPageSize(5)
                        ->load();
                    if(!empty($posts)){         
                        foreach($posts as $post):
                ?>
                            <div>
                                <?php // $post is already defined ?>
                                <?php if ($featuredImage = $post->getFeaturedImage()): ?>
                                    <a href="<?php echo $post->getPermalink() ?>">
                                    <img src="<?php echo $featuredImage->getAvailableImage() ?>" alt="<?php echo $this->escapeHtml($post->getPostTitle()) ?>" style="float: left; margin: 8px; width: 120px; height: 120px;" /></a>
                                <?php endif; ?>
                                <span class="news-date"><?php echo $post->getPostDate() ?></span>
                                <h3 class="news-title news-li-title">
                                    <a href="<?php echo $post->getPermalink() ?>">
                                        <?php echo $post->getPostTitle() ?>
                                    </a>
                                </h3>
                                <span class="news-content"><?php echo $post->getPostExcerpt(50) ?> ... <a href="<?php echo $post->getPermalink() ?>">Read More</a></span>
                                <span class="bottom-liner"></span>
                                <p style="text-align: center;">
                                    <br><img src="http://dev.flymasters.cliquecode.com/media/wysiwyg/line_DblGreenHorz.jpg" width="710" height="3" />
                                </p>

                            </div>
                    <?php
                        endforeach;
                    }
                    ?>
                </div>

                <div class="col-sm-3 news-image-right-link-wrapper">
                    <img src="http://dev.flymasters.cliquecode.com/media/wysiwyg/GrizzlyKing.jpg" width="130" height="130" />
                </div>


            </div>
        </div>          
    </div>
</div>

If there is information in any other files you need let me know. Thanks for your help.

  • yes you are right this problem with block type from where you written this two phtml block please provide full code so we can help you – Murtuza Zabuawala Sep 19 '16 at 16:35
  • I assume you mean the code of the two PHTML files. Here they are. – Ian A Sep 19 '16 at 21:00
  • Updated original question with the code from the two files. Thanks – Ian A Sep 19 '16 at 21:11
0

Turns out the issue had to do with rights. Once I set permission to 775 on each of the files it started working fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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