I need add in cart for my products also and custom options, I need display not only total price but also custom options value with price.
Thanks
I need add in cart for my products also and custom options, I need display not only total price but also custom options value with price.
Thanks
In default.phtml file at app/design/frontend/yourpackage/yourtemplate/template/checkout/cart/item
add the below code
<?php if ($_options = $this->getOptionList()):?>
<?php $product=Mage::getModel('catalog/product')->load($_item->getProduct()->getId()); ?>
<?php foreach ($_options as $_option) : ?>
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
<?php foreach ($product->getProductOptionsCollection() as $option) { ?>
<?php if($option->getTitle()==$_option['label']):?>
<strong><?php //echo $this->htmlEscape($_option['label']) ?></strong>
<?php //echo $_formatedOptionValue['value'] ?>
<br/>
<!-- -->
<?php
switch ($option->getGroupByType()) {
case Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT:
foreach ($option->getValuesCollection() as $value) {
if($value->getTitle()==$_formatedOptionValue['value']){
echo "<br/>";
/* echo '|value_id =>'. $value->getId();
echo '|title=>'.$value->getTitle();
echo '|price=>'. $value->getPrice();
echo '|price_type=>'. $value->getPriceType();
echo '|sku=>'. $value->getSku();
echo '|sort_order =>'. $value->getSortOrder();
*/
if($value->getPriceType()=='fixed' && !is_null($value->getPrice())):
echo $value->getPrice()*$this->getQty();
endif;
if($value->getPriceType()=='percent' && !is_null($value->getPrice())):
echo $value->getPrice()*$this->getQty()*$Yourutemprice;
endif;
}
}
break;
default:
if($option->getPriceType()=='fixed' && !is_null($option->getPrice())):
echo $option->getPrice()*$this->getQty();
endif;
if($option->getPriceType()=='percent' && !is_null($option->getPrice())):
echo $option->getPrice()*$this->getQty()*$Yourutemprice;
endif;
}
?>
<!-- -->
<?php endif; ?>
<?php } ?>
<?php endforeach; ?>
<?php endif;?>