1

Hi i'm using this magento wiki to Change Product Image on View Page to Associated Product's Image.

Now when i select any attribute only base image gets changed. All other multiple images remains the same original product's one.

Is there any way to change original image list to associated product images.

1 Answer 1

2

Please use the custom code to get the images from configurable product having associated product

 $_products = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToFilter('type_id','configurable')
    ->getData(); // Get all the configurable product 

    $childProducts= array();
    foreach ($_products as $_product){
    $id = $_product['entity_id'];
    $childProducts[$id] = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($id); // get the Id of configurable product
    }
   $new_arr= array();
        foreach($childProducts as $childProduct){
        foreach($childProduct as $pro){
        foreach($pro as $prods){
    $product_data = Mage::getModel('catalog/product')->load($prods)
    ->getData(); // Get the collection of associated product from the configurable product
    ?> Product Name[<?php echo $product_data['sku']; ?>] :=  <?php echo $product_data['image'].'</br>'; // Here you got the all information of associated product.
    }
  }

} 

Hope this will help you Thankyou.

4
  • Hi i'm getting an list of all associated products linked with configurable product. Is there any way to ajax call it to get only selected associated product ? For further details kindly refer this thread link Commented Jul 24, 2014 at 9:59
  • On which based you want the selected product..... Commented Jul 25, 2014 at 4:45
  • The above answer is valid as you ask, please confirm here what you want with logic. Commented Jul 25, 2014 at 4:55
  • I've followed this tutorial to get associated product image on configurable product view page. You can see the demo link on that tutorial for the final demo. I've done the same but on my case every single configurable product is linked with more than 40 simple products so my page loading time increased a lot. So i'm planning to make it as ajax call. Like on select of par. attribute get only that product images. Commented Jul 25, 2014 at 5: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.