Display custom option price on cart page in magento
Go to
app/code/core/Mage/Catalog/Helper/Product/Configuration.php and override below function
public function getCustomOptions(Mage_Catalog_Model_Product_Configuration_Item_Interface
$item)
{
$product = $item->getProduct();
$options = array();
$optionIds = $item->getOptionByCode('option_ids');
if ($optionIds) {
$options = array();
foreach (explode(',', $optionIds->getValue()) as $optionId) {
$option = $product->getOptionById($optionId);
if ($option) {
$itemOption = $item->getOptionByCode('option_' . $option->getId());
$group = $option->groupFactory($option->getType())
->setOption($option)
->setConfigurationItem($item)
->setConfigurationItemOption($itemOption);
if ('file' == $option->getType()) {
$downloadParams = $item->getFileDownloadParams();
if ($downloadParams) {
$url = $downloadParams->getUrl();
if ($url) {
$group->setCustomOptionDownloadUrl($url);
}
$urlParams = $downloadParams->getUrlParams();
if ($urlParams) {
$group->setCustomOptionUrlParams($urlParams);
}
}
}
/* Edited code */
foreach ($option->getValues() as $item_img){
$price = $item_img->price;
}
/* End Edited code */
$options[] = array(
'label' => $option->getTitle(),
'value' => $group->getFormattedOptionValue($itemOption->getValue
()),
'print_value' => $group->getPrintableOptionValue($itemOption-
>getValue()),
'option_id' => $option->getId(),
'option_type' => $option->getType(),
'price' => $price, /* Edited Code*/
'custom_view' => $group->isCustomizedView()
);
}
}
}
then go to app/design/frontend/default/theme/template/checkout/cart/item/default.phtml
write below code after this <?php echo $_formatedOptionValue['value']; ?>
<?php echo $_option['price']; ?>