MCQs > IT & Programming > Magento > Assuming that trees must have categories as parents and products as children, and that there are no sub-categories under main categories, which code samples will get the full catalog tree?

Magento MCQs

Assuming that trees must have categories as parents and products as children, and that there are no sub-categories under main categories, which of the following code samples will get the full catalog tree?

Answer

Correct Answer: $categories = Mage::getModel('catalog/category') ->getCollection(); foreach ($categories as $category) { print $category->getName(); $products = Mage::getModel('catalog/category') ->load($category->getId()) ->getProductCollection(); foreach($products as $product){ Print $product->getName(); } }

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Magento Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Magento Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it