Question Returning Associated Products

Please LogIn to Reply!

Post By: admin | 26-01-2012 06:35 Reply


Using the following code will return all the associated products regardless if the simple products are applied to a store config scope…

$associated_products $_product->loadByAttribute('sku'$_product->getSku())->
            foreach (
$associated_products as $assoc{
if ($assoc->getImage() != 'no_selection' && $assoc->getImage() ) {
<img src="
                <?php echo $this->helper('catalog/image')->init($assoc, 'thumbnail', $assoc->image)->resize($additionalImageSize[0], $additionalImageSize[1]);?>
//end if
//end foreach

Is there a way to get only associated products (simple products) that defined to the website? 
The options menu related to the configurable product knows if the simple product is available on the website being viewed.

I’m really struggling with getting a working result of site specific configurable products. any help would be grateful

Thank you


Products are set up as:
->Product (Configurable Product - Websites: Site1 & Site 2)
--->Product Option #1 (Simple Product - Websites 1&2;)
--->Product Option #2 (Simple Product - Websites 1&2;)
--->Product Option #3 (Simple Product - Websites 2)

This code chunk is sitting in the media.phtml file


Lets say we are looking at Website 1
The code chunk above will return an array containing Product Option #3 with the store_id of the currently viewed store & even though the simple product is not configured for Website 2. 

Any help on having the array of returned objects only be those of the current store would be grateful..

Thank you


$associated_products Mage::getModel('catalog/product_type_configurable')->

Is the solution .. the hint came from

`Reply Or Comment!
Please LogIn to Reply!