Magento2 Get Current Product

[Solved] Magento2 Get Current Product | Php - Code Explorer | yomemimo.com
Question : magento 1.9 get all product

Answered by : glorious-guanaco-7sus9evc7d80

//to overwrite limit but you need first to increase your memory limit $collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*') // select all attributes
->setPageSize(5000) // limit number of results returned
->setCurPage(1); // set the offset (useful for pagination)
// we iterate through the list of products to get attribute values
foreach ($collection as $product) { echo $product->getName(); //get name echo (float) $product->getPrice(); //get price as cast to float echo $product->getDescription(); //get description echo $product->getShortDescription(); //get short description echo $product->getTypeId(); //get product type echo $product->getStatus(); //get product status // getCategoryIds(); returns an array of category IDs associated with the product foreach ($product->getCategoryIds() as $category_id) { $category = Mage::getModel('catalog/category')->load($category_id); echo $category->getName(); echo $category->getParentCategory()->getName(); // get parent of category } //gets the image url of the product echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA). 'catalog/product'.$product->getImage(); echo $product->getSpecialPrice(); echo $product->getProductUrl(); //gets the product url echo '<br />';
}

Source : https://stackoverflow.com/questions/8880657/magento-get-all-products | Last Update : Tue, 17 Nov 20

Answers related to magento2 get current product

Code Explorer Popular Question For Php