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

Page 2 of 2
Create featured product and show in home page using custom attribute
 
aceph
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2011-12-03
Karachi, Pakistan
 

Here you can get a modified version of this tutorial to Multiple Featured Products Block on Hompage

http://aceph.pk/magento-create-featured-product-block-on-home-page/

Hope it help you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mkk_kashif
Jr. Member
 
Total Posts:  25
Joined:  2010-12-22
 

Call following code directly from any .phtml file.

<?php
$category_id 
34;
echo 
$this->getLayout()->createBlock('catalog/product_list')->setCategoryId($category_id)->setTemplate('catalog/product/list.phtml')->toHtml();
?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
awickrama
Jr. Member
 
Total Posts:  1
Joined:  2011-07-19
 

I had add featured products to home page with this code.

<?php
        
// some helpers
        
$_helper $this->helper('catalog/output');
        
$storeId Mage::app()->getStore()->getId();
        
$catalog $this->getLayout()->createBlock('catalog/product_list')->setStoreId($storeId);

        
// get all products that are marked as featured
        
$collection Mage::getModel('catalog/product')->getCollection();
        
$collection->addAttributeToSelect('featured');
        
$collection->addFieldToFilter(array(
            array(
'attribute' => 'featured''eq' => true),
        ));

        
// if no products are currently featured, display some text
        
if (!$collection->count()) :
    
?>

    
<class="note-msg"><?php echo $this->__('There are no featured products at the moment .'?></p>

    
<?php else : ?>

<?php
        $_collectionSize 
$collection->count();
        
$_columnCount 4;
        
$i 0;
        
$rand_productnum rand(0$_collectionSize);
        foreach (
$collection as $_product) :
             
$_product Mage::getModel('catalog/product')->setStoreId($storeId)->load($rand_productnum); 

    
?>
    
  
        <?php 
endforeach ?>



<div id="featured-product-img" class="float-l leftcol"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(155); ?>" width="155" height="175" /></div>
    <!--
Right col-->
    <
div class="float-r rightcol">
    <!--
Heading-->
    <
div id="product-name"><?php echo $_helper->productAttribute($_product$_product->getName(), 'name'?></div>
    <!--
Description
    
<div id="product-description">Fresh toning make-up remover</div>-->
    <!--
Price-->
    <
div id="product-price">&pound<?php $p $_product->getFinalPrice(); echo sprintf("%.2f",$p);  ?></div>
    
    <!--
spacer-->
    <
div class="price-btns-spacer"></div>
    
    
    <!--
View product button-->
    <
div class="cellpadding-light"><a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/btn-view-product.png') ?>" width="96" height="22" border="0" /></a></div>
    
    <!--
Add to cart-->
    <
div class="cellpadding-light"><a href="#" onclick="setLocation('<?php echo $catalog->getAddToCartUrl($_product) ?>')"><img src="<?php echo $this->getSkinUrl('images/btn-add-to-cart.png') ?>" width="96" height="22" border="0" /></a></div>
    <!--
Add to wishlist-->
    <
div class="cellpadding-light"><a href="#"><img src="<?php echo $this->getSkinUrl('images/btn-add-to-wishlist.png') ?>" width="96" height="22" border="0" /></a></div>

    </
div>

    
<?php endif ?>

Get in to this site for more info.This thing really worked.

http://www.awebsolution.info/magento-add-random-featured-products-home-page
Site

Image Attachments
featured_product_in_home_page.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
gindib
Jr. Member
 
Total Posts:  7
Joined:  2009-11-24
 
medlington2 - 09 February 2011 06:23 AM

Hi,

I’ve managed to get the products to show correctly in my middle column ‘content’ by using the method on the wiki and assigning the products to an inactive category but now I need to move it to the right hand column.

How would I go about this?

I tried changing the line

{{block type="catalog/product_list" category_id="8" template="catalog/product/list.phtml"}}

to

<block type="catalog/product_list" category_id="8" template="catalog/product/list.phtml"/>

and placed this in the design section rather than the content section and this did show the products but it wasnt limited to the inactive category and seemed to show all the products. It was as if it wasnt getting the information about the category number.

Is there a simple way to move the block to the right? or failing that could I hard code the category number into the file catalog/product/list.phtml somehow?

Thanks

Try this for the XML…

<block type="catalog/product_list" name="featured_products" as="featured" template="catalog/product/featured.phtml">
<action method="setCategoryID"><category_id>8</category_id></action>
</block>

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webtex
Sr. Member
 
Avatar
Total Posts:  219
Joined:  2010-06-05
Minneapolis, USA
 

Hello,

Bomb! \”Featured Products Slider\” will help you to display products everywhere you need on your website.

Regards, Alex

 
Magento Community Magento Community
Magento Community
Magento Community
 
bhavikshah237
Jr. Member
 
Total Posts:  3
Joined:  2013-04-25
 

@ Amol Kharat,
i am new to Magento.....
i am using your code for add feature product at homepage.... but using your code my Featured Product Block is make empty....
Can you explain how to create featured.phtml file??

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webtex
Sr. Member
 
Avatar
Total Posts:  219
Joined:  2010-06-05
Minneapolis, USA
 

Hi,

Please contact me on email alex.vinar@webtexsoftware.com

Regards, Alex

 
Magento Community Magento Community
Magento Community
Magento Community
 
Balbir Rana
Jr. Member
 
Total Posts:  1
Joined:  2013-06-07
 

Hi......Can anyone help me here I am new in magento ):

I want to show all (Is Featured: Yes) featured product on my home page. So How can I do this? Please help!

Regards: Balbir Rana

 
Magento Community Magento Community
Magento Community
Magento Community
 
Harry12
Jr. Member
 
Total Posts:  19
Joined:  2013-05-21
 

You can follow this tutorial: http://magentotutorial.net/display-products-home-page/

Try this, Hope you succeed!

 
Magento Community Magento Community
Magento Community
Magento Community
 
hkpatel201
Jr. Member
 
Total Posts:  25
Joined:  2013-03-31
 

HI please check this post, working great…

How to show featured products in Magento

Thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2