0

I have around of 3000 product in my website. I want to display all product names with product links in a single page in alphabetic order.

How can I do that? Please help.

2 Answers 2

2

Try this

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSort('name', 'ASC');

foreach ($collection as $product) {
  echo $product->getName() .' '. $product->getProductUrl() . PHP_EOL;
}
1

Try below way to get all products

$collection = Mage::getModel('catalog/product')
                         ->getCollection()
                         ->addAttributeToFilter('*');
                         ->addAttributeToSort('name', 'ASC');
 foreach($collection as $_product)
{
    echo $_product->getName();   //product name
    echo $_product->getProductUrl();  //product link
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.