I want to add a new checkbox labeled as "Featured" in create/edit products page in Magento Admin. This determines if a product is a featured product or not.
These are my requirements :
- Add "is_featured" column in products table in database
- In create/edit products page in General Tab in Admin, add a checkbox with label "Featured"
- When saving the product and the "Featured" checkbox is checked, save the value 1 to "is_featured" column in products table, else save the value 0.
On the front-end side, when querying products via magento collection query, i want to sort products and make Featured product as first on the list. Adding is_featured column in db will allow me to sort(descending order) the products easily via is_featured column, sample code :
$_productCollection = Mage::getResourceModel('catalog/product_collection') ->setStoreId(0) ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left') ->addAttributeToFilter('category_id', array('in' => $category_ids)) ->addAttributeToSelect('*') ->addAttributeToFilter('visibility', 4) // Only catalog, search visiblity ->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED)) ->addAttributeToSort('is_featured', 'DESC')
How do i get started or what's the best way to achieve the requirements mentioned above?
The purpose of the requirements above is to sort easily the products via is_featured column