2 Comments

Get all product information

Pagination not working
get review rating star by product id magento

How to display all Product Information in particular Attribute set like Product name , sku , attributes etc..

It shows Attribute Name & Id but i want all details like Product name , sku , attributes etc..

<?php
      require_once('app/Mage.php');
      umask(0);
      Mage::app();//->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
      $entityType = Mage::getModel('catalog/product')->getResource()->getTypeId();
      $collection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter($entityType);
      $allSet = array();
      foreach($collection as $coll){
         $attributeSet['name'] = $coll->getAttributeSetName();
         $attributeSet['id'] = $coll->getAttributeSetId();
         $allSet[] = $attributeSet;
      }
      echo "<pre>";
      print_r($allSet);
      echo "</pre>";
?>

Related Posts

  • Get Random Product (2)
    How to get Random Product here? It always show first 5 product i want to show random product <div class="Seller-other-product"> <?php $active = Mage::getStoreConfig('marketplace/admin_approval_seller_registration/displayproductpage'); if ($active == 1) { […]
  • Product collection has no name attribute how can I get it magento2? (3)
    I tried this code but :- $product = $this->_objectManager->create('MagentoCatalogModelResourceModelProductCollection') ->addAttributeToSelect('*') ->addAttributeToFilter('entity_id', array('in' => $productIds)); echo '<pre>'; […]
  • Product collection has no name attribute how can I get it magento2? (3)
    I tried this code but :- $product = $this->_objectManager->create('MagentoCatalogModelResourceModelProductCollection') ->addAttributeToSelect('*') ->addAttributeToFilter('entity_id', array('in' => $productIds)); echo '<pre>'; […]
  • Product image not displaying in Product listing Page (1)
    I have created one attribute called imageUrl for importing product image url. And made some changes in media.phtml and list.phtml. Now product images not displaying in product list page but it displays images in product details page.. <img src="<?php echo […]
  • how to display size attribue as dropdown? [closed] (2)
    In product details page, value of size attribute is displayed like: I want to display it as dropdown. Please help. The below code is use to choose whether it should be a dropdown or a swatch: <dd class="clearfix swatch-attr<?php if ($_attribute->decoratedIsLast) echo ' […]
  • Magento 2: Details and More Information tabs (4)
    On one of the sample data products, it shows a More Information tab which, unsurprisingly, displays more information for the product. I've looked at the same product in the Admin area, but can't see where to add in the additional information for the tabs. Anyone know where this […]
  • Load custom collection with multiple category ids (1)
    I am using magento 1.9 version. I am having custom collection which consists category ids. I tried to get the collection based on the category ids. I followed this link. I tried with this code too. $collection->addAttributeToFilter('category_id', array('in' => array('finset' […]
  • I Need to Collect the Product Randomly, with store id (1)
    I want to show the Product with randomly on particular site from Multistore and Status is enabled, Stock is Instock and Select the All attributes from these collection of Product In Magento Home Page
  • I Need to Collect the Product Randomly, with store id (1)
    I want to show the Product with randomly on particular site from Multistore and Status is enabled, Stock is Instock and Select the All attributes from these collection of Product In Magento Home Page
  • Show a tick/message over a bundled product when the product is already in the cart (1)
    I am showing custom products on the product page using this code: <?php $bundle_products = $_product->getbundle_products(); if ($_product->getAttributeText('bundle') == yes): $product_ids = explode(',',$bundle_products); $collection = […]
Pagination not working
get review rating star by product id magento

2 Comments on this article

  • User November 12, 2016

    You can do it this way:

    First, filter whatever attributes you need from the collection:

    $_products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('sku')->addAttributeToSelect('name');
    

    Then loop through these products and do what you want

    foreach ($_products as $product){
        $sku = $product->getData('sku');
        echo $sku . '<br>';
         // generally
        $attribute = $product->getData('attribute');
    
    }
    

    Reply

  • User November 12, 2016

    To get a list of attributes for each attribute set you can use:

    Mage::getModel('catalog/product_attribute_api')->items($attributeSetId);
    

    Try with this code:

            ...
            $entityType = Mage::getModel('catalog/product')->getResource()->getTypeId();
            $collection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter($entityType);
            $allSet = array();
            foreach($collection as $coll){
                $attributeSet['name'] = $coll->getAttributeSetName();
                $attributeSet['id'] = $coll->getAttributeSetId();
    
                $attributeSet['attributes'] = Mage::getModel('catalog/product_attribute_api')->items($coll->getAttributeSetId());
    
                $allSet[] = $attributeSet;
            }
    
            echo "<pre>";
            print_r($allSet);
            echo "</pre>";
            ...
    

    Reply

Add a comment