I need to loop through all categories and then extract products for each category. Actually, I need to build a table with product data per category. I also need to extract existing tier prices, because I loop through configurable products only.
<?php
require 'app/Mage.php';
$app = Mage::app('default'); // Mage_Core_Model_App
$ids = Mage::getModel('catalog/category')->getCollection()->getAllIds();
foreach ($ids as $categoryId) {
$category = Mage::getModel('catalog/category')->load($categoryId);
echo $category->getName() . ' <br/>';
$products = $category->getProductCollection()
->addAttributeToFilter('type_id',array('eq'=>'configurable'));
foreach ($products as $tmp) {
$product = Mage::getModel('catalog/product')->load($tmp->getId());
echo $product->getName() . ' ' . $product->getSku() . ' ' . $product->getPrice() . ' <br/>';
}
}
What I don't know is how to print all available product attributes of $product
. For example, I don't know the name of attribute that contains product quantity and can't call it using magic _get method.
And the last thing, is how to extract all existing tier prices from this product? Do they already stored in the $product
object?
Price from product you can get using magic _get, like $product->getPrice(). Or $product->getData('price'), $product->getData('name'), $product->getData();
Gl on that