Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3694886
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:33:03+00:00 2026-05-19T04:33:03+00:00

I have a piece of code that returns product data including a price. However

  • 0

I have a piece of code that returns product data including a price. However for a grouped product it doesn’t give the price.

Is there a way to take the ID of the grouped product and get the lowest price of the group?

Here is my code:

<?php
    $id_array = strip_tags($this->getLayout()->createBlock('cms/block')->setBlockId('homepage-newest-product')->toHtml());
    $product_id = explode(',',$id_array);


    foreach ($product_id as $id):
        $productDetails = Mage::getModel('catalog/product')->load($id)->getData();
        //var_dump($productDetails);
    ?>
    <li class="a-center span-3">
        <a href="<?php echo $this->getBaseUrl() . $productDetails['url_path']; ?>"><img src="<?php echo $media_url . 'catalog/product' . $productDetails['thumbnail']; ?>" width="80" height="80"/></a>
        <a href="<?php echo $this->getBaseUrl() . $productDetails['url_path']; ?>" class="clearfix"><?php echo $productDetails['name']; ?></a>
        <?php if($productDetails['price']): ?>
        <span>
        <?php echo $_coreHelper->currency($productDetails['price'],true,false) ?>
        </span>
        <?php endif; ?>
    </li>
    <?php endforeach; ?>

Preferebly I’d have a function that takes the grouped ID and looks up the lowest price of the group, then returns the price.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:33:03+00:00Added an answer on May 19, 2026 at 4:33 am

    The method looks like below:

    public function prepareGroupedProductPrice($groupedProduct)
    {
        $aProductIds = $groupedProduct->getTypeInstance()->getChildrenIds($groupedProduct->getId());
    
        $prices = array();
        foreach ($aProductIds as $ids) {
            foreach ($ids as $id) {
                $aProduct = Mage::getModel('catalog/product')->load($id);
                $prices[] = $aProduct->getPriceModel()->getPrice($aProduct);
            }
        }
    
        krsort($prices);
        $groupedProduct->setPrice(array_shift($prices));
    
        // or you can return price
    }
    

    Also you can prepare price with events, but this issue is the simplest way to get lowest group price.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If have a piece of code that gets some data from a sql database
It is commonly known that typeof null returns object. However, I have a piece
I have this simple piece of code that returns what's in the title. Why
I have a piece of code that imports data into a sql table. When
I have this piece of code $.get('/proc.php?proc=get_color', function(data){ $('#offer_color').html(data); }); that is hosted on
Let's say I have to implement a piece of T-SQL code that must return
I have this piece of code that does not work: public CartaoCidadao() { InitializeComponent();
I have this piece of code that works fine in subsonic 2.2, I migrated
I have a piece of code that load a very big image in memory.
I have a piece of code that takes several rows from a database and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.