1 Comment

Get associated products of group in parts

How to change theme programatically for specific controller?
how to set payment method based on country in magento?

I need to load associate products in parts/portions.

I am showing 3 products default. After that I have added a link (“load more”). Once the user clicks on “load more”, the next 3 products should be added in the table.

Maybe this could be DONE by Offset but how can I do this? I don’t understand.

I don’t know how I can get associate products collection.

Please help if any one know how I divide associated collection in parts/portions.

Below is my code

        $product = Mage::getModel('catalog/product');
$product->load('157902');
         $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product)->setCurPage(2)->setPageSize(2);

But collection is empty when I used offset , current page or page size

Related Posts

  • Pagination count and collection display issue for custom collection (2)
    I have displayed custom collection on my custom page. The issue i am facing is that pagination is supposed to limit the collection per page but here in frontend whole collection is displayed on one page and the page count shows as Items 1 to 20 of 20 Total for the collection count […]
  • Programmatically created one grouped product associates can be link to other group product? (0)
    I have created programmatically grouped product now i want to this associates link to other group and this associates products shows as two different product with its qty.Not add one product with adding quantitys as default of magento.
  • Magento2: product page returns error (0)
    With no apparent reason, product pages do not show for me anymore. Error text: Warning: Illegal offset type in isset or empty in /path/to/project/vendor/magento/module-eav/Model/Entity/Attribute/Source/AbstractSource.php on line 74 I tried to xdebug it, here is what I found. Error […]
  • Incorrect number of pagination links (0)
    I am using below code to get collection of associated products of a grouped product. public function getCollection() { $limit = 16; $curr_page = 1; $dir='ASC'; $orderBy='name'; if(Mage::app()->getRequest()->getParam('p')) […]
  • Configurable product options – get price difference in brackets (1)
    I know that a few themes have this by default but my one doesn't, and i just cant get this to work. I have a configurable Product which has three options with different prices. I want to show the price difference to the linked simple product in brackets. So it should basically look […]
  • Complex sorting on list pages (0)
    On Magento 1.9.2.4 we would like to have the sorting on list pages by default load all the products by subcategory, and within the subcategory collection we want to sort the product by prices. Any way we can do that?
  • While getting the productCollection trough $block->getLoadedProductCollection(), no access on custom attributes – why? (2)
    The Problem: I am modifying the Magento_Catalog/templates/product/list.phtml and I'm trying to access my custom attribute ku_untetitel. In the .phtml, I'm using the following code to get the productCollection (magento default): $_productCollection = […]
  • Default languages changes when we directly open the category or product page link (0)
    Default languages changes when we directly open the category or product or any CMS page links on the browser,and if we go back to home page then default languages loaded, and then it worked for all pages. I have checked my default language, and its set properly in Backend how can i […]
  • how to add default products to related products list (3)
    I want to add default products of certain ids(example- 1,5,7,3) to be added to the list of related products always with all the products at the end for the product page and need not store in database, how to add these with related product collection in magento
  • Magento2 – Product Collection with custom condition (1)
    What is the best practice for adding custom condition of following collection? Category view detail page product collection Search page product collection Give me some advice for that. How can I add condition with magento 2 default collection functionality. Thanks in advance!
How to change theme programatically for specific controller?
how to set payment method based on country in magento?

1 Comment on this article

  • User November 12, 2016

    This should do what you are looking for, setCurPage is the start of the Offset, and setPageSize is the number of items return starting from the offset:

    $product = Mage::getModel('catalog/product');
    $product->load('157902');
    $_simples = Mage::getModel('catalog/product_type_grouped')->getAssociatedProductCollection($product)->setCurPage(0)->setPageSize(2);
    foreach ($_simples as $key => $value) {
        Zend_Debug::dump($value->getEntityId());
    }
    

    Reply

Add a comment