Pages

5/17/2012

As I already mentioned on the previous post that we only can give the condition of attribute name to filter the result. There is another method to filter result that you can use in your customer Module. Let you are having a customer module which is responsible to show some banner on the homepage. For that let you have some place to upload image and also have feature to give sort order and enable disable feature. Here in the below code I will show how to filter the result with addFieldtoFilter

$banner = Mage::getModel('mymodulename/banner')->getCollection();

Now I wish to show banner whose status are active. I already have a field name/column name 'status' in my custom table.

$banner -> addFieldToFilter('status', array('eq' => 1));

Now I will sort the result according to sort order in my table. I already have a field name 'sort_order' in my table. To sort according to that column I will write

addAttributeToFilter Condition is used to Filter the collection query of magento . we can use to to filter the result of category collection, Product Collection, Customer collection, Order collection etc.

When you use this condition into the collection make sure your filterable option should be an attribute not should be a table column or fieldname.

Below is the example to fetch all products and using addAttributeToFilter to filter the result

$collection = Mage::getModel('catalog/product')->getCollection();

Below are all types of condition which you can use To Filter the result

If you’re contemplating buying a new smartphone in Australia, you need to take the time to research your product. Just like buying a new car, you need to be sure what you’re buying is reliable and serves your needs completely. Find all the latest smartphones and reviews online through Mobileciti and be confident you’re buying the best product. The best smart phone is often not the most popular, so it pays to research and read mobile phone reviews.

In-depth smart phone reviews and comparisons

You can find everything you need to conduct your smartphone comparison online at Mobileciti. Smartphones Australia wide are selling at a rapid pace so keep up to date with the latest developments by reading mobile phone reviews. Be it an Android smart phone or the latest Windows mobile you’re after, Mobileciti can provide detailed reviews and comparisons on all makes of smart phones so you can be sure you’re buying the best and most suitable product for you.

Conduct your smart phone review today and find the perfect mobile phone for you needs to make your telecommunications easier and more efficient. Read below for all the mobile phone reviews and smart phone comparisons from Mobileciti.