Skip to content

Instantly share code, notes, and snippets.

@cjsaylor
Created August 5, 2012 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjsaylor/9acaa7d1504e57ece36e to your computer and use it in GitHub Desktop.
Save cjsaylor/9acaa7d1504e57ece36e to your computer and use it in GitHub Desktop.
application_event_for_plugin_blog_3
<?php
public function addItem(Item $item, $quantity) {
// Trigger event before the item is added
EventManager::trigger('cart.before-add', compact('item', 'quantity'));
// Some cart logic here to add the item
// Trigger event after the item is added
EventManager::trigger('cart.after-add', compact('item', 'quantity'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment