Last active
January 21, 2018 11:17
-
-
Save fballiano/6f73f3dff1cec9a42ef7 to your computer and use it in GitHub Desktop.
Magento product collections, general loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$store_id = Mage::app()->getStore()->getId(); | |
$collection = Mage::getModel("catalog/product")->getCollection(); | |
$collection->setStoreId($store_id); | |
$collection->addStoreFilter($store_id); | |
//$collection->addAttributeToSelect("*"); | |
$collection->addAttributeToFilter('status', array('in' => array(Mage_Catalog_Model_Product_Status::STATUS_ENABLED))); | |
$collection->addAttributeToFilter('visibility', array('in '=> array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH))); | |
Mage::getSingleton("cataloginventory/stock")->addInStockFilterToCollection($collection); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment