php - Magento 1.7 show products from 2 categories in block -


i wanted create block display products 2 (or more) categories. i've tried in several ways don't work.

how tried:

/app/code/local/mage/catalog/block/product/fulllist.php (same list.php changed _getproductcollection() function:)

protected function _getproductcollection() { $_productcollection = mage::getmodel('catalog/product')     ->getcollection()     ->joinfield('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left')     ->addattributetoselect('*')     ->addattributetofilter('category_id', array(         array('finset' => '30'),         array('finset' => '32'))     )         ->addattributetosort('created_at', 'desc');          return $_productcollection; } 

then, @ 1 of cms pages tried use:

{{block type="catalog/product_fulllist" template="catalog/product/list.phtml"}} 

but doesn't seem work, page clear. missing part? or there easier way that?

greetings!

hello check below code

$collection = mage::getmodel('catalog/product')->getcollection();   $collection->joinfield('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left');  $collection->addattributetofilter('category_id', array('in' => array('finset'=>'30,31')));  $collection->addattributetosort('created_at', 'desc');  $collection->addattributetoselect('*');  return $collection; 

Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -