Reading list Switch to dark mode

    Magento : How to Get Product Information

    Updated 17 February 2011

    Magento Product Information : If you are developing Magento template sooner or later you will need to obtain some product information and rearrange it to fit your template. One of the most useful function while working with Magento is Mage::getModel($modelClass).

    Here is how you would use it to retrieve Magento product information Mage::getModel(‘catalog/product’);.

    This ‘catalog/product’ relates to app/code/core/Mage/Catalog/Model/Product.php file. If you open that file you will see it’s actually a class named Mage_Catalog_Model_Product. That same class is extending theMage_Catalog_Model_Abstract class meaning it inherits all of it’s methods.

    ” $Product = Mage::getModel(‘catalog/product’);

    $Product->load(164);

    Searching for an experienced
    Magento Company ?
    Find out More

    echo ‘<p>Product name: <strong>’ . $Product->getPrice() . ‘</strong></p>’; ”

    This tiny code will fetch the data from the ProductID , which i set here 164 . You can fetch all the product information e.g – price,weight , imageurl and many more .

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home