I have a "New Arrival" Category. I need to show the Latest product of the top level category ( Mens->New arrival) and limit the products. I have tried to override the below category block. But not achieve that.

File Path : \\app\code\core\Mage\Catalog\Model\Category.php

if($this->getId()==463){ // New arrival Category ID
    $category = Mage::getModel('catalog/category')->load(18);   // Mens category ID            
    $collection = Mage::getResourceModel('catalog/product_collection')
    $collection = Mage::getResourceModel('catalog/product_collection')

2 Answers 2


Try below code:

$_categoryId = 18;
$category = Mage::getModel('catalog/category')->load($_categoryId );
$productCollection = $category->getProductCollection();

  • I already tried above code, but return all products for that category. Its not assigned the product collection.
    – Rat
    Apr 21, 2018 at 7:24
  • @Rat , try updated code above Apr 21, 2018 at 7:27
  • its not working. while printing the $collection get the 20 produts for above code. But not assigned the productcollection of actual magento
    – Rat
    Apr 21, 2018 at 7:32
  • @Rat , i updated code. try please. Also flat category is enabled in your site? Apr 21, 2018 at 8:30
  • Raiput , Flat category is disabled. I tried the above code, its loading long time
    – Rat
    Apr 21, 2018 at 8:55

Edit Your code




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.