Posted By

stalal on 05/23/12


Tagged

category collection magento spcific


Versions (?)

Magento


 / Published in: PHP
 

URL: http://thaider.info

Get Magento product by specific category id (Magento version 1.7)

  1. <?php
  2. $_category = Mage::getModel('catalog/category')->load(3);
  3.  
  4. $_testproductCollection = Mage::getResourceModel('catalog/product_collection')
  5. ->addCategoryFilter($_category)
  6. ->addAttributeToSelect('*');
  7. $_testproductCollection->load();
  8.  
  9. foreach($_testproductCollection as $_testproduct){
  10. echo $sp_name = $this->htmlEscape($_testproduct->getName());
  11. echo $sp_desc = $this->htmlEscape($_testproduct->getShortDescription());
  12. echo $sp_image = $this->htmlEscape($_testproduct->getImageUrl());
  13. echo $sp_url = $this->htmlEscape($_testproduct->getUrlPath());
  14. echo $sp_price = $this->htmlEscape($_testproduct->getPrice());
  15. };
  16. ?>

Report this snippet  

You need to login to post a comment.