本文整理匯總了PHP中type::getEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::getEvent方法的具體用法?PHP type::getEvent怎麽用?PHP type::getEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::getEvent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: inventoryplus_before_show_title
/**
* Change title of Inventoryplus
*
* @param type $observer
*/
public function inventoryplus_before_show_title($observer)
{
$title = $observer->getEvent()->getTitle();
$text = '<h3><a href="javascript:void(0);" onclick="showDashboardMenu();">' . '<span><i class="fa fa-th"></i> ERP Plus | Inventory Management </span></a></h3>';
$text .= '<div id="erp_menu_dashboard">' . Mage::app()->getLayout()->createBlock('erpplus/adminhtml_dashboard')->setTemplate('erp_plus/page/dashboard-menu.phtml')->toHtml() . '</div>';
$title->setText($text);
}
示例2: addMassAction
/**
* Add mass action in catalog > product view
* @param type $observer
*/
public function addMassAction($observer)
{
$block = $observer->getEvent()->getBlock();
if (get_class($block) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction' && $block->getRequest()->getControllerName() == 'catalog_product') {
$block->addItem('BarcodeLabel', array('label' => Mage::helper('BarcodeLabel')->__('Print barcode labels'), 'url' => Mage::app()->getStore()->getUrl('BarcodeLabel/Admin/printSelectedProductLabel')));
}
}
示例3: orderState
/**
* Sets order STATE based on status.
*
* @param type $o
*/
public function orderState($o)
{
$order = $o->getEvent()->getOrder();
if (!is_object($order->getPayment())) {
return $o;
}
$_c = $order->getPayment()->getMethod();
if (Mage::helper('sagepaysuite')->isSagePayMethod($_c) === false) {
return $o;
}
$methodInstance = $order->getPayment()->getMethodInstance();
$methodInstance->setStore($order->getStoreId());
$action = $methodInstance->getConfigPaymentAction();
$state = Mage_Sales_Model_Order::STATE_NEW;
if ($action == Ebizmarts_SagePaySuite_Model_Api_Payment::ACTION_AUTHORIZE_CAPTURE or $action == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
}
$order->setState($state);
/* Set order status based on ReD response.
* $sagedata = $this->_getTransactionsModel()->loadByParent($order->getId());
$ReD = $sagedata->getRedFraudResponse();
if(strtoupper($ReD) == 'DENY') {
$order->setStatus('security_check');
}*/
}
示例4: checkTax
/**
* Checks
* @param type $observer
*/
public function checkTax($observer)
{
$block = $observer->getEvent()->getBlock();
if ($block instanceof Mage_Checkout_Block_Total_Tax && $block->getTotal()) {
$block->setTemplate('rewards/checkout/total/tax.phtml');
$total = $block->getTotal()->getValue();
// If tax is included in the produt price then we should subtract the change in tax price from the
// tax total visually only.
$store = $block->getTotal()->getAddress()->getQuote()->getStore();
if (Mage::helper('tax')->priceIncludesTax($store)) {
$total -= $block->getTotal()->getAddress()->getQuote()->getRewardsDiscountTaxAmount();
}
$block->setTotalInclCatalogDiscounts($total);
}
}
示例5: customerLogin
/**
*
* @param type $observer
* @return void
*/
public function customerLogin($observer)
{
$customer = $observer->getEvent()->getCustomer();
$session = Mage::getSingleton('customer/session');
$latchId = $customer->getData('latch_id');
if ($latchId) {
/* @var $latchHelper Joc_Latch_Helper_Data */
$latchHelper = Mage::helper('latch');
$latchEnabled = $latchHelper->getIfLatchEnabled($latchId, $customer->getId());
if ($latchEnabled['status'] == 1) {
$session->setId(null)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)->getCookie()->delete('customer');
Mage::getSingleton('core/session')->addError($latchEnabled['message']);
}
return;
}
}
示例6: approvePoints
/**
* Approve an affiliate point transfer if the admin has the option enabled to
* auto approve pending transfers
*
* @param type $observer
* @return TBT_RewardsReferral_Model_Observer_Sales_Order_Invoice_Pay
*/
public function approvePoints($observer)
{
$order = $observer->getEvent()->getInvoice()->getOrder();
if (!$order) {
return $this;
}
if (!Mage::helper('rewards/config')->shouldApprovePointsOnInvoice()) {
return $this;
}
$collectionReference = Mage::getResourceModel('rewardsref/referral_order_transfer_reference_collection');
/* @var TBT_RewardsReferral_Model_Mysql4_Referral_Order_Transfer_Reference_Collection */
$collectionReference->addTransferInfo();
$collectionReference->filterAssociatedWithOrder($order->getId());
$collectionReference->addFieldToFilter('status', array('eq' => TBT_Rewards_Model_Transfer_Status::STATUS_PENDING_EVENT));
$this->_approvateTransferReferences($collectionReference);
return $this;
}
示例7: assignVolumelicense
/**
* When a pending customer registers we are assigning him the shared volume license.
* @param type $observer
*/
public function assignVolumelicense($observer)
{
$event = $observer->getEvent();
$customer = $event->getCustomer();
$email = $customer->getEmail();
$shareaccess = Mage::getModel('volumelicense/registry')->getCollection()->getBySharedEmail($email);
// Mage::log(''.$shareaccess->getSelect(),null,'access.log');
if (sizeof($shareaccess) != 0) {
foreach ($shareaccess as $share) {
// Mage::log($share->getData(),null,'access.log');
$sharemodel = Mage::getModel('volumelicense/registry')->load($share->getId());
$sharemodel->setAssignStatus(1);
$sharemodel->setAssignCustomerId($customer->getEntityId());
$sharemodel->setUpdateTime(date('m/d/y h:i:s', time()));
$sharemodel->save();
}
}
}
示例8: orderState
/**
* Sets order STATE based on status.
*
* @param type $o
*/
public function orderState($o)
{
$order = $o->getEvent()->getOrder();
if (!is_object($order->getPayment())) {
return $o;
}
$_c = $order->getPayment()->getMethod();
if (Mage::helper('sagepaysuite')->isSagePayMethod($_c) === false) {
return $o;
}
$methodInstance = $order->getPayment()->getMethodInstance();
$methodInstance->setStore($order->getStoreId());
$action = $methodInstance->getConfigPaymentAction();
$state = Mage_Sales_Model_Order::STATE_NEW;
if ($action == Ebizmarts_SagePaySuite_Model_Api_Payment::ACTION_AUTHORIZE_CAPTURE or $action == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
}
$order->setState($state);
}
示例9: core_block_abstract_prepare_layout_after
/**
* Add mass-actions to the sales order grid, the non-intrusive way.
* @param type $observer
*/
public function core_block_abstract_prepare_layout_after($observer)
{
$block = $observer->getEvent()->getBlock();
#Mage::log('XTENTO - Controller name is: '.$block->getRequest()->getControllerName(), null, '', true);
if (in_array($block->getRequest()->getControllerName(), $this->getControllerNames())) {
$isSecure = Mage::app()->getStore()->isCurrentlySecure() ? true : false;
if ($block->getRequest()->getActionName() !== 'exportCsv' && $block->getRequest()->getActionName() !== 'exportExcel') {
// Do not add columns if admin is exporting orders using the built-in Magento CSV/Excel XML export - you don't want the carrier dropdown/select there
if (($block instanceof Mage_Adminhtml_Block_Widget_Grid || $block instanceof Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid) && $block->getId() == 'sales_order_grid') {
if (Mage::getStoreConfigFlag('gridactions/general/add_trackingnumber_from_grid') && Mage::helper('gridactions')->getModuleEnabled()) {
// Add tracking & carrier fields to grid
if (Mage::getStoreConfigFlag('gridactions/general/add_trackingnumber_from_grid_combined')) {
$block->addColumn('combined-input', array('header' => Mage::helper('gridactions')->__('Carrier / Tracking'), 'type' => 'text', 'sortable' => false, 'renderer' => 'Xtento_GridActions_Block_Adminhtml_Sales_Order_Grid_Widget_Renderer_Combined', 'filter' => 'Xtento_GridActions_Block_Adminhtml_Sales_Order_Grid_Widget_Renderer_Combined', 'width' => 190));
} else {
$block->addColumn('carrier-selector', array('header' => Mage::helper('gridactions')->__('Shipping Carrier'), 'type' => 'text', 'sortable' => false, 'renderer' => 'Xtento_GridActions_Block_Adminhtml_Sales_Order_Grid_Widget_Renderer_Carrier', 'filter' => 'Xtento_GridActions_Block_Adminhtml_Sales_Order_Grid_Widget_Renderer_Carrier', 'width' => 190));
$block->addColumn('tracking-input', array('header' => Mage::helper('gridactions')->__('Tracking Number'), 'type' => 'text', 'sortable' => false, 'renderer' => 'Xtento_GridActions_Block_Adminhtml_Sales_Order_Grid_Widget_Renderer_Trackingnumber', 'filter' => 'Xtento_GridActions_Block_Adminhtml_Sales_Order_Grid_Widget_Renderer_Trackingnumber', 'width' => 170, 'after' => 'carrier-selector'));
}
}
}
}
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction || $block instanceof Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction) {
if (!$this->_initBlocks($block)) {
return;
}
if (Mage::registry('moduleString') !== 'false') {
return;
}
$enabledActions = explode(",", Mage::getStoreConfig('gridactions/general/actions'));
// Add mass-actions to the sales order grid
$actions = Mage::getModel('gridactions/system_config_source_actions')->toOptionArray();
foreach ($actions as $action) {
$actionCode = $action['value'];
$actionName = $action['label'];
if (!in_array($actionCode, $enabledActions) && isset($enabledActions[0]) && $enabledActions[0] !== 'all') {
continue;
}
if ($this->_isAllowed($actionCode)) {
$block->addItem($actionCode, array('label' => Mage::helper('gridactions')->__($actionName), 'url' => Mage::app()->getStore()->getUrl('*/gridactions_grid/mass', array('actions' => $actionCode, '_secure' => $isSecure)), 'selected' => $actionCode == 'invoice' ? true : false));
}
}
}
}
}
示例10: changeButton
/**
* Update buttons in Sales Order
*
* @param type $observer
*/
public function changeButton($observer)
{
if (!Mage::helper('inventoryplus')->isInInventorySection()) {
return;
}
$block = $observer->getEvent()->getBlock();
if (get_class($block) == 'Mage_Adminhtml_Block_Sales_Order_Shipment_View') {
$shipmentId = $block->getRequest()->getParam('shipment_id');
$shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
$orderId = $shipment->getOrderId();
$block->removeButton('save');
$block->removeButton('delete');
$block->updateButton('back', 'onclick', 'setLocation(\'' . $block->getUrl('adminhtml/sales_order/view', array('order_id' => $orderId, 'active_tab' => 'order_shipments', 'inventoryplus' => '1')) . '\')');
}
if (get_class($block) == 'Mage_Adminhtml_Block_Sales_Order_Shipment_Create' && $block->getRequest()->getParam('inventoryplus') == '1') {
$orderId = $block->getRequest()->getParam('order_id');
$block->updateButton('back', 'onclick', 'setLocation(\'' . Mage::helper('adminhtml')->getUrl('adminhtml/ins_inventoryshipment/index') . '\')');
}
if (get_class($block) == 'Mage_Adminhtml_Block_Sales_Order_View') {
$orderId = $block->getRequest()->getParam('order_id');
$block->removeButton('print');
$block->removeButton('save');
$block->removeButton('delete');
$block->removeButton('order_hold');
$block->removeButton('order_unhold');
$block->removeButton('void_payment');
$block->removeButton('accept_payment');
$block->removeButton('deny_payment');
$block->removeButton('get_review_payment_update');
$block->removeButton('send_notification');
$block->removeButton('void_payment');
$block->removeButton('order_reorder');
$block->removeButton('order_edit');
$block->removeButton('order_cancel');
$block->removeButton('order_creditmemo');
$block->removeButton('order_invoice');
$block->updateButton('order_ship', 'onclick', 'setLocation(\'' . $block->getUrl('adminhtml/sales_order_shipment/new', array('order_id' => $orderId, 'inventoryplus' => '1')) . '\')');
$block->updateButton('back', 'onclick', 'setLocation(\'' . Mage::helper('adminhtml')->getUrl('adminhtml/ins_inventoryshipment/index') . '\')');
}
}
示例11: assignVolumelicense
/**
* When a pending customer registers we are assigning him the shared volume license.
* @param type $observer
*/
public function assignVolumelicense($observer)
{
$event = $observer->getEvent();
$customer = $event->getCustomer();
if ($customer) {
$email = $customer->getEmail();
$order = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('future_email', $email);
if (sizeof($order) != 0) {
foreach ($order as $od) {
$od->setCustomerFirstname($customer->getFirstname());
$od->setCustomerLastname($customer->getLastname());
$newCustomerEmail = $customer->getEmail();
$od->setCustomerId($customer->getId());
$od->setCustomerEmail($customer->getEmail());
$od->setFutureEmail(NULL);
// $od->addStatusHistoryComment('The owner has been changed from customer: ' . $oldCustomerEmail . ' to customer: ' . $customer->getEmail() . ' by user ' . Mage::getSingleton('admin/session')->getUser()->getUsername());
$items = $od->getAllItems();
try {
$od->save();
foreach ($items as $item) {
if ($item->getProductType() == 'downloadable') {
$downloadableLinks = Mage::getModel('downloadable/link_purchased')->getCollection()->addFieldToFilter('order_item_id', $item->getItemId());
foreach ($downloadableLinks->getItems() as $link) {
$link->setCustomerId($customer->getId());
$link->save();
}
}
}
/* $parent_order_id = $od->getParentOrderId();
$parentOrderData = Mage::getModel('sales/order')->load($parent_order_id);
$parentEmail = $parentOrderData->getCustomerEmail();
*/
// $helper->volumeLicenseShareEmail($toEmail,$purchasingAgentMailData,$parentEmail);
} catch (Exception $e) {
Mage::log($e->getMessage());
}
}
}
}
}
示例12: prepareOrderForDataSync
/**
* Attach to sales_order_save_after event
*
* @see sales_order_save_after
* @param type $observer
*/
public function prepareOrderForDataSync($observer)
{
if (Mage::getStoreConfig('mailup_newsletter/mailup/enable_log')) {
Mage::log("TRIGGERED prepareOrderForDataSync");
}
$order = $observer->getEvent()->getOrder();
/* @var $order Mage_Sales_Model_Order */
$customerId = $order->getCustomerId();
//$customer = Mage::getmodel('customer/customer')->load($customerId);
/* @var $customer Mage_Customer_Model_Customer */
if ($this->_hasCustomerDataSynced) {
return;
// Don't bother if nothing has updated.
}
//$storeId = $customer->getStoreId(); // Is this always correct??
$storeId = $order->getStoreId();
if ($customerId) {
self::setCustomerForDataSync($customerId, $storeId);
$this->_hasCustomerDataSynced = TRUE;
}
}
示例13: loadPaymentechInfo
/**
* Event: customer_load_after
*
* Attach the customer's CIM id to the customer profile when loaded
*
* @param type $observer
* @return Gorilla_AuthorizenetCim_Model_Observer
*/
public function loadPaymentechInfo($observer)
{
$customer = $observer->getEvent()->getCustomer();
Mage::getModel('chasepaymentech/profile')->loadInfoByCustomer($customer);
return $this;
}
示例14: inp_get_current_username
/**
* Catch event inp_get_current_username to switch to webpos user
*
* @param type $observer
*/
public function inp_get_current_username($observer)
{
$user = $observer->getEvent()->getUser();
if ($user->getUsername()) {
return;
}
if (!Mage::helper('inventoryplus')->isWebPOS20Active()) {
return;
}
if ($curUser = Mage::getSingleton('webpos/session')->getUser()) {
$user->setUsername($curUser->getUsername());
}
}
示例15: productAddCart
/**
* Track add to cart
* @param type $observer
*/
public function productAddCart($observer)
{
try {
$product = $observer->getEvent()->getProduct();
$table = Intelivemetrics_Unityreports_Model_Utils::getTableName('unityreports/product_counters');
$query = "INSERT INTO {$table} (product_id,addtocarts,last_updated_at) VALUES ({$product->getEntityId()},1,NOW())\n ON DUPLICATE KEY UPDATE addtocarts = addtocarts+1,last_updated_at=NOW();";
Mage::getSingleton('unityreports/utils')->getDb()->query($query);
//track customer action
$customer = Mage::getModel('unityreports/customer');
if ($customer->isKnown()) {
$customer->trackAdd2cart($product->getSku());
}
Mage::getSingleton('unityreports/utils')->getDb()->closeConnection();
} catch (Exception $ex) {
Mage::helper('unityreports')->debug($ex->getMessage(), Zend_Log::ERR);
Mage::helper('unityreports')->debug('FILE: ' . __FILE__ . 'LINE: ' . __LINE__);
}
}