1

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

1
  • 1
    Would you be able to provide a bit more information regarding your issue? Feb 25, 2016 at 7:43

1 Answer 1

1

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());
}
2
  • But Its showing Nothing on browser :( I want grouped product assciated products not for configurable. Is there any way?
    – konika
    Mar 3, 2016 at 7:14
  • Updated answer, note the model and method called changed. I don't have any grouped products in my local environment at the moment to verify but this should work.
    – B00MER
    Mar 3, 2016 at 7:38

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.