Magento – Change product price on selection of custom option (checkbox)

custom-optionsmagento-1.9priceproduct-list

I have displayed Magento products on my site's homepage. Some products have some custom options of checkbox type. I have displayed those custom options under the product image. But I do not have any idea how to change particular product price after checking or unchecking that custom option checkbox.

enter image description here

Here is the code which I have used to display custom options:

$options = Mage::getModel('catalog/product_option')->getProductOptionCollection($emq_product);

//for showing custom options
foreach($options as $o) {
    //echo $o->getTitle();
    $emq_type = $o->getType();
    if ($emq_type=="checkbox") {
        foreach($o->getValues() as $v) {
            echo $v->getTitle();
            echo "<input  id='".$emq_prod_id."' type='checkbox' class='emq_chk' price='". number_format($v->getPrice())."'/>";
        }                           
    }
}

Best Answer

You need to give a price to the option, get a look at the screenshot enter image description here