3

I am creating a special page only for the particular customer group.. So, Regardless of category, i need to get the products those are having exclusive price for that customer group..

I tried with the following but it's not working:

Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect('*')
    ->addFieldToFilter('customer_group_id', $groupId);

Any help would be greatly appreciated.

4
  • you mean a particular customer group?
    – Nikitas
    Dec 18, 2013 at 13:42
  • Yes.. one particular customer group newly created. Dec 18, 2013 at 13:49
  • not working? what are you getting?
    – Shathish
    Dec 19, 2013 at 9:11
  • Fatal error: Call to a member function getBackend() on a non-object in /var/www/html/asterix/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816 Dec 19, 2013 at 9:24

1 Answer 1

2

Finally found the answer by myself..

<?php

$id = $this->getRequest()->getParam('id'); //Customer Group Id

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
 $collection->getSelect()->join(array('cpgp'=>Mage::getResourceModel('catalog/product')->getTable('catalog/product_attribute_group_price')),"e.entity_id=cpgp.entity_id and cpgp.customer_group_id='".$id."'",'*');

foreach($collection as $product)
{
    //Code Here
}

?>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.