Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Help home page products failed
 
themobilephonesite
Jr. Member
 
Total Posts:  25
Joined:  2008-08-11
 

Hi I am trying to put selected products on the home page of my site http://www.themobilephonesite.com, i followed the instructions on a thread by dan_w http://www.magentocommerce.com/boards/viewthread/4454/.

I downloaded homepage.php & homepage.phtml and uploaded them to the corresponding folders on the server.

I also inserted CSS code in Boxes.css but it keeps failing. the page will not load correctly and i get the message

Fatal error: Class ‘Mage_Review_Helper_Product’ not found in /var/www/vhosts/themobilephonesite.com/httpdocs/app/code/core/Mage/Core/Model/App.php on line 779 please see attached image.

here is the code i inserted.
homepage.phtml

<?php if (($_products $this->getProductCollection()) && $_products->getSize()): ?>
<div class="home-page-cntr">
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
    <?php 
if ($i>5): continue; endif; ?>

<div class="home-page-item">
        <
div class="home-page-img">
            <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                 <
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(65,65); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
            </
a>
        </
div>
        <
div class="home-page-txt">
            <
p><class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $_product->getName() ?></a></p>
            
<?php echo $this->helper('review/product')->getSummaryHtml($_product'short'?>
            <?php 
echo $this->helper('catalog/product')->getPriceHtml($_product?>
            
</div>
</
div>
<?php $i++; endforeach; ?>
<?php 
for($i;$i%5!=0;$i++): ?>
    <?php 
endfor ?>
</div>
<?php endif; ?>

Homepage.php

class Mage_Catalog_Block_Product_Homepage extends Mage_Catalog_Block_Product_Abstract
{
    
public function __construct()
    
{
        parent
::__construct();

        
$storeId    Mage::app()->getStore()->getId();
        
$product    Mage::getModel('catalog/product');
        
/* @var $product Mage_Catalog_Model_Product */
        
$todayDate  $product->getResource()->formatDate(time());
        
$products   $product->setStoreId($storeId)->getCollection()
            ->
addAttributeToFilter('home_page_featured', array('yes'=>true))
            ->
addAttributeToSelect(array('name''price''small_image'), 'inner')
            ->
addAttributeToSelect(array('special_price''special_from_date''special_to_date'), 'left')
        ;
       
/* @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
        
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
        
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);

      
$products->setOrder('hot_deals')->setPageSize(5)->setCurPage(1);

        
$this->setProductCollection($products);
    
}
}
Block in cms
{{block type="catalog/product_homepage" name="home.catalog.product.homepage" alias="product_homepage" template="catalog/product/homepage.phtml"}}
CSS
.home-page-cntr{
    width
445px;
    
floatright;
    
margin0 0 0 15px;
    
border1px solid #ccc;
    
}
.home-page-cntr a{
    text
-decorationnone;
    
font-weightnormal;
    
}
.home-page-cntr a:hover {
    color
#000000;}
.home-page-cntr h3 {
    padding
2px 5px;
    
background-color#eee;
    
border-bottom1px solid #ccc;}
.home-page-item, .home-page-item1{
    float
left;
    
width120px;
    
height170px;
    
padding8px;
    
border-right1px solid #ccc;
    
margin5px 5px 10px 5px;
    
line-height16px;
    
}
.home-page-item1{
    border
-rightnone;
    
}
.home-page-img{
    }
.home-page-txt{
    font
-size11px;
    
font-weightbold;
    
}

Where am i going wrong, please advise, i have also created the attribute which i have inserted to the defaults which works.

Its driving me crazy so please help.

Thank you

Image Attachments
mpserror.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
Naresh Vajawat
Member
 
Total Posts:  47
Joined:  2008-09-22
India
 

Hi,

It is hard to find the problem with this and i see that the image gets loaded but not the other content. Did you try toload just the images and see if it worked ? ( just a suggestion ) . There might be an issue with the function call getProductUrl. Let me know if you have already found out a solution for the same.

Thanks,
Naresh

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top