How can i do this without change core files
1 Answer
You can do it by Observer.
1.You need to add Following Event in Config.xml
<sales_quote_collect_totals_before>
<observers>
<hackathon_presentation>
<type>singleton</type>
<class>modulename/observer</class>
<method>salesQuoteAddressCollectTotalsBefore</method>
</hackathon_presentation>
</observers>
</sales_quote_collect_totals_before>
**In Observer.php add below mentioned code **
public function salesQuoteAddressCollectTotalsBefore($observer)
{
$quote = $observer->getQuote();
$quote_items = $quote->getItemsCollection();
foreach ($quote_items as $item) {
$additionalOptions = array(
array(
'code' => 'my_code',
'label' => 'This text is displayed through additional options',
'value' => 'ID is ' . $item->getProductId() . ' and SKU is ' . $item->getSku()
)
);
$item->addOption(
array(
'code' => 'additional_options',
'value' => serialize($additionalOptions),
)
);
}
}