当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Event_Observer::setEvent方法代码示例

本文整理汇总了PHP中Varien_Event_Observer::setEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::setEvent方法的具体用法?PHP Varien_Event_Observer::setEvent怎么用?PHP Varien_Event_Observer::setEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Event_Observer的用法示例。


在下文中一共展示了Varien_Event_Observer::setEvent方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: helperGenerateObserver

 /**
  * Generates observer object
  *
  * @param array $eventData
  * @param string $eventName
  *
  * @return Varien_Event_Observer
  */
 public function helperGenerateObserver($eventData, $eventName = null)
 {
     $event = new Varien_Event($eventData);
     $observer = new Varien_Event_Observer();
     $observer->setEvent($event);
     if ($eventName) {
         $event->setName($eventName);
         $observer->setEventName($eventName);
     }
     $observer->addData($eventData);
     return $observer;
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:20,代码来源:Observer.php

示例2: testDispatchEventDoesNotCallApiIfNoMessages

 public function testDispatchEventDoesNotCallApiIfNoMessages()
 {
     $e = new Varien_Event();
     $e->setName('triggerCode');
     $observer = new Varien_Event_Observer();
     $observer->setEvent($e);
     $events = $this->getEventCollection();
     $this->observer->expects($this->once())->method('getEvents')->with('event', 'triggerCode')->will($this->returnValue($events));
     $messages = array();
     $this->messageProcessor->expects($this->once())->method('processEvents')->with($events, $observer)->will($this->returnValue($messages));
     $this->esendexApi->expects($this->never())->method('sendMultipleMessages');
     $this->observer->dispatchEvent($observer);
 }
开发者ID:WeareJH,项目名称:esendex-magento-extension,代码行数:13,代码来源:ObserverTest.php

示例3: testGoogleAnonymizationDisabled

 /**
  * @test
  * @loadFixture testGoogleAnonymizationDisabled
  */
 public function testGoogleAnonymizationDisabled()
 {
     $block = $this->app()->getLayout()->createBlock('googleanalytics/ga')->setTemplate('googleanalytics/ga.phtml');
     $transport = new Varien_Object();
     $transport->setHtml($block->toHtml());
     $event = new Varien_Event();
     $event->setData('block', $block);
     $event->setData('transport', $transport);
     $observer = new Varien_Event_Observer();
     $observer->setEvent($event);
     $this->_model->setGAAnonymizerCode($observer);
     $this->assertNotContains('_anonymizeIp', $observer->getEvent()->getTransport()->getHtml());
 }
开发者ID:mrafulfill,项目名称:firegento-magesetup,代码行数:17,代码来源:Observer.php

示例4: setRowUrl

 /**
  * @test
  * @loadFixture ~FireGento_AdminMonitoring/default
  */
 public function setRowUrl()
 {
     $history = Mage::getModel('firegento_adminmonitoring/history')->load(8);
     $transport = new Varien_Object();
     $observer = new Varien_Event_Observer();
     $event = new Varien_Event();
     $event->setData('history', $history);
     $event->setData('transport', $transport);
     $observer->setEvent($event);
     $observer->setData('history', $history);
     $observer->setData('transport', $transport);
     $this->_model->setRowUrl($observer);
     $this->assertContains('sales_order/view/order_id/1/', $transport->getRowUrl());
 }
开发者ID:giuseppemorelli,项目名称:firegento-adminmonitoring,代码行数:18,代码来源:Order.php

示例5: testReturnButtonLoaded

 public function testReturnButtonLoaded()
 {
     $handle_15 = 'dhlonlineretoure_button_return_15';
     $handle_16 = 'dhlonlineretoure_button_return_16';
     /* @var $observer Dhl_OnlineRetoure_Model_Observer */
     $observer = Mage::getModel('dhlonlineretoure/observer');
     $action = new Varien_Object();
     $action->setFullActionName('sales_order_view');
     $event = new Varien_Event(array('action' => $action, 'layout' => Mage::getSingleton('core/layout')));
     $eventObserver = new Varien_Event_Observer();
     $eventObserver->setEvent($event);
     $observer->addReturnButtonHandle($eventObserver);
     $handles = $eventObserver->getEvent()->getLayout()->getUpdate()->getHandles();
     if (version_compare(Mage::getVersion(), '1.6.0.0', '<')) {
         $this->assertContains($handle_15, $handles);
     } else {
         $this->assertContains($handle_16, $handles);
     }
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:19,代码来源:ObserverTest.php

示例6: submitCancellations

 /**
  * @param Varien_Event_Observer $observer
  */
 public function submitCancellations($observer)
 {
     /** @var Mage_Sales_Model_Order_Creditmemo $creditMemo */
     $creditMemo = $observer->getCreditmemo();
     $data['order'] = $creditMemo->getOrder();
     $data['credit_memo'] = $creditMemo;
     $event = new Varien_Event($data);
     $observer = new Varien_Event_Observer();
     $observer->setEvent($event);
     $this->cancelOrder($observer);
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:14,代码来源:Observer.php

示例7: prepareStockItemObserver

 private function prepareStockItemObserver(Mage_Catalog_Model_Product $product)
 {
     /** @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
     $stockItem = Mage::getModel('cataloginventory/stock_item');
     $stockItem->loadByProduct($product->getId())->setProductId($product->getId());
     foreach ($product->getData('stock_item')->getData() as $key => $value) {
         $stockItem->setOrigData($key, $value);
     }
     $observer = new Varien_Event_Observer();
     $observer->setEvent(new Varien_Event());
     $observer->setData('item', $stockItem);
     return $observer;
 }
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:13,代码来源:ObjectChange.php

示例8: _cronSetShippingCompleted

 /**
  * cron to set the shipping to complete
  */
 protected function _cronSetShippingCompleted()
 {
     /** @var Shopgate_Framework_Model_Resource_Shopgate_Order_Collection $collection */
     $collection = Mage::getResourceModel('shopgate/shopgate_order_collection')->getUnsyncedOrders();
     $this->log(">> Found {$collection->getSize()} potential orders to send", ShopgateLogger::LOGTYPE_DEBUG);
     foreach ($collection as $order) {
         /* @var $order Shopgate_Framework_Model_Shopgate_Order */
         $this->log(">> Order with ID {$order->getId()} loaded", ShopgateLogger::LOGTYPE_DEBUG);
         $this->log(">> Call observer->setShippingStatus", ShopgateLogger::LOGTYPE_DEBUG);
         $shipment = Mage::getModel('sales/order_shipment')->setOrderId($order->getOrderId());
         $event = new Varien_Event(array('data_object' => $shipment, 'shipment' => $shipment));
         $eventObserver = new Varien_Event_Observer();
         $eventObserver->setEvent($event);
         Mage::getModel('shopgate/observer')->setShippingStatus($eventObserver);
     }
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:19,代码来源:Plugin.php

示例9: testAppendReceiverEmail

 public function testAppendReceiverEmail()
 {
     $request = new Dhl_Intraship_Model_Soap_Client_Shipment_Create();
     $parcel = new Varien_Object();
     $shipment = new Varien_Object();
     $billingAddress = new Varien_Object();
     $billingAddress->setPackageNotification(true);
     $shipment->setBillingAddress($billingAddress);
     $parcel->setShipment($shipment);
     $receiver = new Varien_Object();
     $receiver->setEmail('test@test.de');
     $shipmentOrder = array('Shipment' => array('Receiver' => array('Communication' => array('email' => null))));
     $params = new Dhl_Intraship_Model_Soap_Client_Shipment_Create();
     $params->offsetSet('ShipmentOrder', $shipmentOrder);
     $request->offsetSet('shipment', $parcel);
     $request->offsetSet('receiver', $receiver);
     $request->offsetSet('params', $params);
     $observer = Mage::getModel('dhlaccount/observer');
     $event = new Varien_Event_Observer();
     $eventData = new Varien_Object();
     $eventData->setRequest($request);
     $event->setEvent($eventData);
     $observer->appendReceiverEmail($event);
     $shipmentOrder = $request->offsetGet('params')->offsetGet('ShipmentOrder');
     $this->assertTrue(array_key_exists('Shipment', $shipmentOrder));
     $this->assertTrue(array_key_exists('Receiver', $shipmentOrder['Shipment']));
     $this->assertTrue(array_key_exists('Communication', $shipmentOrder['Shipment']['Receiver']));
     $this->assertTrue(array_key_exists('email', $shipmentOrder['Shipment']['Receiver']['Communication']));
     $this->assertEquals('test@test.de', $shipmentOrder['Shipment']['Receiver']['Communication']['email']);
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:30,代码来源:ObserverTest.php

示例10: afterSaveOrder

 /**
  * After save order.
  *
  * @param Varient_Event_Observer $observer
  */
 public function afterSaveOrder(Varien_Event_Observer $observer)
 {
     /* @var $event Varien_Event */
     $event = $observer->getEvent();
     /* @var $quote Mage_Sales_Model_Quote */
     $quote = $event->getQuote();
     if (!$quote) {
         return $this;
     }
     /* @var $item Mage_Sales_Model_Quote_Item */
     foreach ($quote->getAllItems() as $item) {
         $productId = $item->getProductId();
         if ($productId) {
             $product = Mage::getModel('catalog/product')->load($productId);
             $event = new Varien_Event(array('product' => $product));
             $observer = new Varien_Event_Observer();
             $observer->setEvent($event);
             self::afterSaveProduct($observer);
         }
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:26,代码来源:Observer.php

示例11: testPaymentMethodIsActive

 /**
  * @test
  * @loadFixture testPaymentMethodIsActive
  */
 public function testPaymentMethodIsActive()
 {
     $model = Mage::getModel('debit/debit');
     $checkResult = new StdClass();
     $checkResult->isAvailable = true;
     $observer = new Varien_Event_Observer();
     $event = new Varien_Event();
     $event->setData('method_instance', $model);
     $event->setData('result', $checkResult);
     $observer->setData('method_instance', $model);
     $observer->setData('result', $checkResult);
     $observer->setEvent($event);
     $this->_model->paymentMethodIsActive($observer);
     $this->assertTrue($observer->getEvent()->getResult()->isAvailable);
 }
开发者ID:pette87,项目名称:Magento-DebitPayment,代码行数:19,代码来源:Observer.php

示例12: testDisableCaptureForZeroAmountInvoice

 public function testDisableCaptureForZeroAmountInvoice()
 {
     $ccPaymentObject = Mage::getModel('ops/payment_cc');
     $block = new Mage_Adminhtml_Block_Sales_Order_Invoice_Create_Items();
     $payment = Mage::getModel('sales/order_payment');
     $payment->setMethodInstance($ccPaymentObject);
     $order = Mage::getModel('sales/order');
     $order->setPayment($payment);
     $invoice = Mage::getModel('sales/order_invoice');
     $invoice->setBaseGrandTotal(0.0);
     $invoice->setOrder($order);
     $observer = Mage::getModel('ops/observer');
     $event = new Varien_Event_Observer();
     Mage::register('current_invoice', $invoice, true);
     $eventData = new Varien_Event();
     $event->setEvent($eventData);
     $event->getEvent()->setData('block', $block);
     $this->assertTrue($ccPaymentObject->canCapture());
     $observer->disableCaptureForZeroAmountInvoice($event);
     $this->assertFalse($ccPaymentObject->canCapture());
     // clean up invoice from registry after test
     Mage::unregister('current_invoice');
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:23,代码来源:ObserverTest.php

示例13: setUp

 protected function setUp()
 {
     $this->_observer = new Mage_DesignEditor_Model_Observer();
     $this->_eventObserver = new Varien_Event_Observer();
     $this->_eventObserver->setEvent(new Varien_Event(array('layout' => Mage::app()->getLayout())));
 }
开发者ID:nemphys,项目名称:magento2,代码行数:6,代码来源:ObserverTest.php


注:本文中的Varien_Event_Observer::setEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。