Search code examples
xmllayoutreferenceblockmagento-1.9

Magento Layout XML - Block on a page disappeared - Inchoo Featured Products Plugin


I have an existing Magento template that has been working. Just after what seems to be an unrelated change - A new Category was added - a block of content disappeared. The content is pulled in using the Layout XML for the static page - home.

Here is the XML to add the block - it appears correct:

<reference name="featured">
   <block type="featuredproducts/listing"  name="featured_products"
   as="featured_products" template="inchoo/block_featured_products.phtml">
   </block>
</reference>

*lines breaks were added for formating

and here is the block_featured_products.phtml that resides in the folder: /public_html/app/design/frontend/themename/themename/template/inchoo/

<?php 
/**
 *
 * @category   Inchoo
 * @package    Inchoo Featured Products
 * @author     Domagoj Potkoc, Inchoo Team <[email protected]>
 */
?>
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>

<div style="float: left;width: 522px;margin: 0 0 7px 0;height: 156px; background: url(<?php echo $this->getSkinUrl('images/featured_bg.png') ?>) no-repeat;">

    <div class="title_box"><?php echo $this->__('Featured Product') ?></div>

    <?php $i=0;$row=0; foreach ($_products->getItems() as $_product): ?>

        <div style="width:100%;float:left;">
        <div style="float: left; width: 160px; height: 120px;text-align: center;">
            <p class="product-image">
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><img class="product-img" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(120, 90) ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
            </p>
        </div>
        <style>
        .regular-price .price {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: normal;
}
.price-box {
    background: url("<?php echo $this->getSkinUrl('images/foronly.png') ?>") no-repeat 0 2px;
    padding: 5px 0 10px 90px;
}
.col-3-layout .col-main {
min-height: 0px;
height:462px;
}
</style>
        <div style="float: left; width: 300px; height: 120px;">
                <h5><a style="color: #FFFFFF;display: block;font-size: 18px;padding: 5px 0 0;text-decoration: none;" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $this->htmlEscape($_product->getName()) ?></a></h5>

                <?php echo $this->getPriceHtml($_product, true, '-new') ?>
                <?php if($_product->isSaleable()): ?>
                <button type="button" class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                <?php else: ?>
                <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
                <?php endif; ?>
                <a style="color: #FFFFFF;font-size: 14px;padding: 0 0 0 8px;text-decoration: none;" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)">Get Product Details</a>
        </div>        

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

</div>
<?php endif; ?>

Neither of the above had changed prior to the disappearing act.

I have tried to flush the cache, turn off the cache, and have verified the file exists. The theme is also in use - but Firebug shows no trace block_featured_products.phtml file.

Any ideas as to why a category addition would cause this goofiness? Other ideas on troubleshooting?

Magento 1.9.0.1 version and the github for the plugin: https://github.com/buric/Inchoo_FeaturedProducts

The installed plugin doesn't seem to have a version number in the comments - I'll be digging into it most likely


Solution

  • I am posting the answer for any one who might find this in the future.

    It seems the the Indexes were the issue - adding a new Category messed them up - BUT - Magento never saw it as a problem and did not report the Indexes being out of date and requiring them to be rebuilt.

    Steps to fix: Click on System > Index Management Click Select All Rebuild All the Indexes

    Then at the right change the actions to Reindex Data and click Submit Reindex Data Action

    For details on the process see: https://docs.nexcess.net/article/how-to-issue-a-reindex-in-magento.html

    Magento never reported the Indexes were wrong - but this fixed the issue.