3

I currently have an extension that replaces the old product view page with a custom one, showing several configurable options, as the customer goes through the options it filters down to a simple product and they can purchase it

I currently have 3 links placed at the bottom of the page which are attributes (related to the simple products) but they only refer to the configurable product.

I have changed the following;

<?php if($_product->getPdfLink()){ ?>
<a href="<?php echo $_product->getPdfLink();  ?>" target="_blank" style="float: left; margin-left: 15px;" ><img src="<?php echo $this->getSkinUrl('images/acrobat_reader_25x25.gif'); ?>" alt="" /></a>
<?php } ?>
<?php if($_product->getPsLink()){ ?>
<a href="<?php echo $_product->getPsLink();  ?>" target="_blank" style="float: left; margin-left: 15px;" ><img src="<?php echo $this->getSkinUrl('images/photoshop_25x25.gif'); ?>" alt="" /></a>
<?php } ?>
<?php if($_product->getIndesignLink()){ ?>
<a href="<?php echo $_product->getIndesignLink();  ?>" target="_blank" style="float: left; margin-left: 15px;" ><img src="<?php echo $this->getSkinUrl('images/indesign_25x25.gif'); ?>" alt="" /></a>
<?php } ?>

To the following;

<?php if($_product->getTypeId() == "configurable"):
    $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
    $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
    foreach($simple_collection as $simple_product){}
endif;
?>
<?php foreach($simple_collection as $simple_product){ ?>
<a href="<?php echo $simple_product->getPdfLink();  ?>" target="_blank" style="float: left; margin-left: 15px;" ><img src="<?php echo $this->getSkinUrl('images/acrobat_reader_25x25.gif'); ?>" alt="" /></a>
<?php } ?>
<?php foreach($simple_collection as $simple_product){ ?>
<a href="<?php echo $simple_product->getPsLink();  ?>" target="_blank" style="float: left; margin-left: 15px;" ><img src="<?php echo $this->getSkinUrl('images/photoshop_25x25.gif'); ?>" alt="" /></a>
<?php } ?>
<?php foreach($simple_collection as $simple_product){ ?>
<a href="<?php echo $simple_product->getIndesignLink();  ?>" target="_blank" style="float: left; margin-left: 15px;" ><img src="<?php echo $this->getSkinUrl('images/indesign_25x25.gif'); ?>" alt="" /></a>
<?php } ?>

The code works, however it actually refers to all of the simple products related to the selected configurable...

How do I get it so it only shows the attributes related to the filtered simple product

Any help is appreciated!

3

The simple product is selected by Javascript when the user select the options. You cant send the Response for the selected simple product before the user select it. A good way to handle this is to trigger an AJAX Request to the Server and parse the options from that.

When all options are Selected and a simple Product is chosen, the Selected ProductID is in (as long as the original configurable_options template is used):

spConfig.config.productId

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.