Home Communication board WiKi Get Quote

Universal way to select a product collection

Usually when you create your own block with some products inside, you are going to use some standard template for the products visualization (or at least the similar one). ou can select all of the required attributes this way in this situation:

        $collection = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('header_product', array('from' => 1))
            ->setOrder('header_product')->setPage(0, 1);

In this code all of the standard Magento filters are applied and all of the standard fields are select. In additional in this code there is the additional filtration by the “header_product” attribute is added and the only the first product with the minimal attribute is selected.

Home About us Privacy statement Terms & Conditions Refund policy © 2007–2022 ArsCommunity