1
        $storeId = Mage::app()->getStore()->getId();
        $customerGroupId = Mage::getSingleton('customer/session')->getCustomer()->getGroupId();
        $productsIds = Mage::getModel('amgroupcat/usergroup')->getProducts($customerGroupId);
        $products = Mage::getResourceModel('reports/product_collection')
            ->addOrderedQty()
            ->addAttributeToSelect('*')
            ->addAttributeToSelect(array('name', 'price', 'small_image'))
            ->setStoreId($storeId)
            ->addStoreFilter($storeId)
            ->addFieldToFilter('entity_id', array('in' => $productsIds))
            ->setOrder('ordered_qty', 'desc'); // most best sellers on top
        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);

I have used this ->addAttributeToFilter('group_id', array('in' => $customerGroupId)) and ->addAttributeToFilter('customer_group_id', array('in' => $customerGroupId)) but not work and showing this error Fatal error: Call to a member function getBackend() on boolean in /data/htdocs/public_html/latitude/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.