2

I've been learning magento1 recently, but I don't know much about how magento gets product details

I just want to get some necessary information about the product and some of the properties I defined, I'll change it again. If you can get your help, this will be very good.

Thank you

0

1 Answer 1

1

if you got the product id then you can get details of a product by using the following method in Magento.

<?php
   $obj = Mage::getModel('catalog/product');
    $_product = $obj->load($product_id); // Enter your Product Id in $product_id
    // get Product's name
    echo $_product->getName();
    //get product's short description
    echo $_product->getShortDescription();
    //get Product's Long Description
    echo $_product->getDescription();
    //get Product's Regular Price
    echo $_product->getPrice();
    //get Product's Special price
    echo $_product->getSpecialPrice();
    //get Product's Url
    echo $_product->getProductUrl();
    //get Product's image Url
    echo $_product->getImageUrl();

    $summaryData = Mage::getModel('review/review_summary')
                    ->load($_product->getId());

if ($summaryData['rating_summary']):?>
    <div class="ratings">
        <div class="rating-box">
            <div class="rating" style="width:<?php echo $summaryData['rating_summary']; ?>%"></div>
        </div>
    </div>
<?php endif; ?>
3
  • $summaryData['rating_summary'] There is nothing inside, I try to print and get null
    – Calvin
    Commented Jun 7, 2018 at 1:57
  • @Calvin that means there is no rating summary for that product. Commented Jun 7, 2018 at 4:32
  • @Calvin, If my answer solves or help in your concern then there is green right tick mark, hit that tickmark for right answer that will help future readers. Commented Jun 7, 2018 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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