0

The featured products code below seems to indicate that there is a method in admin to indicate which products should be included in the featured products displayed. Also that these products will be displayed randomly. I have been through all of the following areas in admin and found no method to specify that a product should be included:

• Manage Categories and all respective tabs available for an individual category • Manage Products and all respective tabs available for an individual product • Individual Product in admin that showed as featured on the home page • System Configuration – sometimes tools are set up with some feature controls there • Promotion • CMS/Static Blocks • CMS/Widgets

Am I misreading the code itself? Is there any are in admin I failed to review? Any feedback would be greatly appreciated.

class Jag_Featuredproduct_Block_Featuredproduct extends Mage_Catalog_Block_Product_Abstract

{

public function _prepareLayout()

{

    return parent::_prepareLayout();

}



public function getFeaturedproducts() {



    $storeId = Mage::app()->getStore()->getId(); 



    $p = Mage::getModel('catalog/product')->setStore($storeId)->getCollection()->addStoreFilter($storeId)

    ->addAttributeToSelect('*')

    //->addFieldToFilter('status',array('eq'=>1))

    ->addFieldToFilter('is_featured', array('eq' => 1));   



     //$p->getSelect()->order('updated_at DESC');

     $p->getSelect()->order(new Zend_Db_Expr('RAND()'));



     $p->getSelect()->limit(8);



     //echo $p->getSelect()->__toString(); exit();



    return $p->getData();



}

}

1

That code is selecting all attributes and then filtering for the attribute "is_featured". So if it's not already available, create that attribute with code "is_featured" and add it to the attribute set, where you want to feature products. Then you can activate it in the specific product edit pages.

  • Thank you so much for replying with helpful information, it is appreciated! – Julie Carlson Apr 26 '13 at 18:48

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.