Advertisement
Guest User

Untitled

a guest
May 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <sales_quote_collect_totals_before>
  2. <observers>
  3. <hackathon_presentation>
  4. <type>singleton</type>
  5. <class>modulename/observer</class>
  6. <method>salesQuoteAddressCollectTotalsBefore</method>
  7. </hackathon_presentation>
  8. </observers>
  9. </sales_quote_collect_totals_before>
  10.  
  11. public function salesQuoteAddressCollectTotalsBefore($observer)
  12. {
  13. $quote = $observer->getQuote();
  14. $quote_items = $quote->getItemsCollection();
  15. foreach ($quote_items as $item) {
  16. $additionalOptions = array(
  17. array(
  18. 'code' => 'my_code',
  19. 'label' => 'This text is displayed through additional options',
  20. 'value' => 'ID is ' . $item->getProductId() . ' and SKU is ' . $item->getSku()
  21. )
  22. );
  23. $item->addOption(
  24. array(
  25. 'code' => 'additional_options',
  26. 'value' => serialize($additionalOptions),
  27. )
  28. );
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement