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

“Featured” products block on home page - Not working --Help please
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

Hey,

i saw this post around about the place.

if you look at the new.phtml line 38 for

<?php if($_product->isSaleable()): ?>

I think this controls whether the product is in stock.

Note: I think there is a bug outstanding to have this work. You will need to add to the new.php file

->addAttributeToSelect(’status’)

Im using the new.phtml about as an example. As its quite similar code the featured.phtml/featured.php code

hth
Brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
finch8243
Sr. Member
 
Total Posts:  79
Joined:  2007-08-31
 

@Brendanb—right, that solution you propose is to edit the displayed query results in the actual phtml file.  I’m curious if there’s a way to edit the actual query itself via the addAttributeToSelect functionality.

Thanks for your help.  I’ll play around with >addAttributeToSelect(’status’) and see what I can get it to do.

 
Magento Community Magento Community
Magento Community
Magento Community
 
anyjoesoap
Jr. Member
 
Total Posts:  6
Joined:  2009-01-27
 

Hi All,

Could someone tell me if nafnaf1000’s code underneath should still work in 1.2.1.2 - It’s pretty straight forward adding Featured Products to the homepage. I’ve implemented it but its simply not rendering on the homepage. Re the last part…

<reference name="content">
<
block type="catalog/product_featured" name="home.catalog.product.featured" alias="product_featured" template="catalog/product/new.phtml"/></reference>

Will the below suffice in my CMS page or where should I place this?

{{block type="catalog/product_featured" name="home.catalog.product.featured" alias="product_featured" template="catalog/product/new.phtml"}}

Many thanks in advance,

nafnaf1000 - 21 May 2008 12:25 PM

Followed the below steps:
1. Create an attribute “home_page_featured” and set possible values to be “Yes” and “No”.
2. Attach the attribute to the attribute set

add app/etc/modules/MyCompany_HomePageFeatured.xml

<?xml version="1.0"?>
<config>
    <
modules>
        <
MyCompany_HomePageFeatured>
            <
active>true</active>
            <
codePool>local</codePool>
        </
MyCompany_HomePageFeatured>
    </
modules>
</
config>
add app/code/local/MyCompany/HomePageFeatured/Block/Product/Featured.php
<?php
class MyCompany_HomePageFeatured_Block_Product_Featured 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(3)->setCurPage(1);

        
$this->setProductCollection($products);

    
}
}

add app/code/local/MyCompany/HomePageFeatured/etc/config.php
<?xml version="1.0"?>
<config>
    <
modules>
        <
MyCompany_HomePageFeatured>
            <
version>0.1.0</version>
        </
MyCompany_HomePageFeatured>
    </
modules>
    <global>
    <
blocks>
      <
catalog>
        <
rewrite>
          <
product_featured>MyCompany_HomePageFeatured_Block_Product_Featured</product_featured>
        </
rewrite>        
      </
catalog>
    </
blocks>
    </global>
</
config>
add block code in to CMS page.
<reference name="content">
<
block type="catalog/product_featured" name="home.catalog.product.featured" alias="product_featured" template="catalog/product/new.phtml"/></reference>

as you can see there is no PHTML file here as i am using the new.phtml as i want it to look the same. You can copy new.phtml (or what ever phtml you want ) and call it featured.phtml and then change it text from “NEW ITEMS” to “Featured Items”

have fun.

if it don not work let me know but it should work.
 
Magento Community Magento Community
Magento Community
Magento Community
 
anyjoesoap
Jr. Member
 
Total Posts:  6
Joined:  2009-01-27
 

Used the below method instead, thanks anyway.

http://www.magentocommerce.com/wiki/how_to/add_featured_products_to_home_page

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hey All,

Just reading your posts.
After some thought, here’s a tutorial on another approach that might be more convenient for showing featured products on the home page: http://eliasinteractive.com/blog/magento-featured-products-a-more-convenient-way-to-display-featured-products-on-the-home-page/

Cheers!
Lee

 
Magento Community Magento Community
Magento Community
Magento Community
 
andrewmp
Jr. Member
 
Total Posts:  8
Joined:  2009-06-20
 

I know this is kind of an old post, but I just used it and it works fine.  There was one problem that may have been giving you guys the errors and the block not showing up.  In nafnaf’s instructions he says to name the config file config.php when it should be named config.xml.  This stumped me for a while but once I changed that it worked great.

The code I put in the home page cms was

{{block type="catalog/product_featured" name="home.catalog.product.featured" alias="product_featured" template="catalog/product/new.phtml"}}

Hopefully this helps someone out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ricebus
Jr. Member
 
Total Posts:  4
Joined:  2009-07-14
 

Hey, I got this extension working only problem is that the products show as “out of stock” although they aren’t.
Anyone has an idea why?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ricebus
Jr. Member
 
Total Posts:  4
Joined:  2009-07-14
 

OK. Got this fixed!
Here’s the new code (changed a few things to support magento 1.3.x)

<?php
class Roseman_HomePageFeatured_Block_Product_Featured 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')
            ->
addAttributeToFilter('visibility', array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTHMage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG ))
            ->
addAttributeToFilter('status'Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
    
        ;

       
/* @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */

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

        
$this->setProductCollection($products);

    
}
}
?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
iba Designs
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2009-02-15
 

Ok, Sorry to resurrect a pretty much dead topic, but I have been working to find a solution to my problem for more than 5 hours now, and I need some help. I have searched, tried, failed, tried and failed again, and at least another 3 or 4 rounds of the same.

What I need is a way to essentially have a way to feature one product on the front page of the site. I am attaching a screen shot of what I want on the home page.

I found one try by someone who got it to work on her site, link here, but this same code she suggested results in the price, buy, add to cart, and email buttons going away for me, plus the image is 600 pixels down the page from where it is supposed to be.

If I could please get some help on this I would greatly appreciate it.

Thanks in advance,
Daniel

Here is the quote fromt he Girl who got it to work on her site, but failed on mine.

Twan - 27 April 2009 07:21 AM

I have been playing with this for my shop home page.

The following works ok for me:

in the CMS, modify the homepage, setting the content to:

<div class="product-info-box">
   <
div class="product-essential">

{{block type="catalog/product_view" product_id="21" template="catalog/product/home.phtml"}}

      
<div class="product-img-box">
{{block type="catalog/product_view_media" product_id="21" template="catalog/product/view/home-media.phtml"}}
      
</div>

      <
div class="product-shop">

         <
h1>Home Page</h1>

         <
div class="collateral-box">
            <
div class="head">
               <
h4>Work in Progress</h4>
            </
div>
{{block type="catalog/product_view" product_id="21" template="catalog/product/view/home-description.phtml"}}
         
</div>
      </
div>
   </
div>
</
div>

in custom design, I also had to add a reference to the product.js to ensure the zooming tool works
<reference name="head">
            <
action method="addJs"><script>varien/product.js</script></action>
</
reference>

ensure each .phtml file is in your frontend design that you are using (I renamed them from their defaults just to avoid conflicts)

the content of home.phtml is simply as follows
<?php
    $productId 
$this->getProduct_id();
    
$product Mage::getModel('catalog/product')->load($productId);  //load the product    
?>

the shop front can be seen at http://www.heydayonline.co.uk

Cheers
Twan van Beers

I tried her solution, but every time I implemented it exaclty as she had, I would get an error saying the the home.phtml didn’t exist even though I had placed it in the spot where her code suggests.

Image Attachments
Screen shot 2010-03-11 at 2.57.37 AM.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
magewidgets
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2010-03-24
USA
 

If you are running 1.4 the easiest solution is a widget. You can find one here http://www.magewidgets.com/featured-products-widget.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cyberscripts
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2011-05-26
India
 

check this extension

http://www.magentocommerce.com/magento-connect/cyberscripts/extension/6920/fancy_featured_product

 
Magento Community Magento Community
Magento Community
Magento Community
 
brunomarshall
Guru
 
Avatar
Total Posts:  367
Joined:  2009-08-04
 

Hello ,

Check if your module appear in admin .

go to system>configuration>advanced>disable module output

you can search for your module.

if it appears on backend check whether you have assigned your attribute to correct attribute set.

and then try

 
Magento Community Magento Community
Magento Community
Magento Community
 
sunil rajput
Jr. Member
 
Total Posts:  17
Joined:  2009-04-04
 

Qick and easy steps on How To Create a Featured Product module in magento
http://www.phptechi.com/how-to-create-a-featured-product-module-in-magento.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
sunil rajput
Jr. Member
 
Total Posts:  17
Joined:  2009-04-04
 

Qick and easy steps on How To Create a Featured Product module in magento
http://www.phptechi.com/how-to-create-a-featured-product-module-in-magento.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kaushik Patel
Jr. Member
 
Total Posts:  28
Joined:  2011-12-24
 

try this....
http://hkpatel201.blogspot.in/2012/12/featured-products-with-magento-in-3.html

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