本文整理汇总了PHP中Varien_Event类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event类的具体用法?PHP Varien_Event怎么用?PHP Varien_Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* @see MageUC_Developer_Bar_Panel_Interface::update(Varien_Event $event)
*/
public function update(Varien_Event $event)
{
if ($event->getName() == self::EVENT_MAGE_LOG) {
self::$_arData[] = array('message' => $event->getMessage(), 'level' => $event->getLevel(), 'file' => $event->getFile());
}
return;
}
示例2: getValidator
/**
* Get quote item validator/processor object
*
* @deprecated
* @param Varien_Event $event
* @return Mage_SalesRule_Model_Validator
*/
public function getValidator($event)
{
if (!$this->_validator) {
$this->_validator = Mage::getModel('salesrule/validator')->init($event->getWebsiteId(), $event->getCustomerGroupId(), $event->getCouponCode());
}
return $this->_validator;
}
示例3: prepareProductObserver
private function prepareProductObserver(Mage_Catalog_Model_Product $product)
{
$event = new Varien_Event();
$event->setProduct($product);
$observer = new Varien_Event_Observer();
$observer->setEvent($event);
return $observer;
}
示例4: update
/**
* @see MageUC_Developer_Bar_Panel_Interface::update(Varien_Event $event)
*/
public function update(Varien_Event $event)
{
if (!isset($this->_arEvents[$event->getName()])) {
$this->_arEvents[$event->getName()] = 0;
}
$this->_arEvents[$event->getName()] += 1;
$this->_totalEventDispatched++;
}
示例5: buildObserver
/**
* Build correct observer structure
*
* @param $data array
*/
protected function buildObserver(array $data)
{
$observer = new Varien_Event_Observer();
$event = new Varien_Event();
$event->setData($data);
$data['event'] = $event;
$observer->setData($data);
return $observer;
}
示例6: dispatchEvent
/**
* @see Mage_Core_Model_App::dispatchEvent($eventName, $args)
*/
public function dispatchEvent($eventName, $args)
{
$event = new Varien_Event($args);
$event->setName($eventName);
$observer = new Varien_Event_Observer();
$observer->setData(array('event' => $event));
$observer->addData($args);
$this->_bar->update($observer->getEvent());
return parent::dispatchEvent($eventName, $args);
}
示例7: addRewardsCatalogTaxDiscounts
/**
* Adds the rewards catalog spending rule discounts to the tax display amount
* @param Varien_Event $observer
*/
public function addRewardsCatalogTaxDiscounts($observer)
{
$event = $observer->getEvent();
$block = $event->getBlock();
if ($block instanceof Mage_Tax_Block_Checkout_Grandtotal && $block->getTotal()) {
$event->getBlock()->setTemplate('rewards/checkout/total/tax/grandtotal.phtml');
$event->getBlock()->setTotalExclTaxExclCatalogRedem($this->getTotalExclTax($block));
}
return $this;
}
示例8: afterOutput
/**
* Executed from the core_block_abstract_to_html_after event
* @param Varien_Event $obj
*/
public function afterOutput($obj)
{
$block = $obj->getEvent()->getBlock();
$transport = $obj->getEvent()->getTransport();
// Magento 1.4.0.1 and lower dont have this transport, so we can't do autointegration : (
if (empty($transport)) {
return $this;
}
$this->_afterOutput($block, $transport);
return $this;
}
示例9: dispatchEvent
/**
* @param $model string model syntax or class name (codex_module/observer or Codex_Module_Model_Observer)
* @param $method string the exact method name (as defined in confix.xml)
* @param $eventName string the original name of the event
* @param array $args array
*/
public static function dispatchEvent($model, $method, $eventName, array $args = array())
{
$event = new Varien_Event($args);
$event->setName($eventName);
$observer = new Varien_Event_Observer();
$observer->setData(array('event' => $event));
$observer->addData($args);
$object = Mage::getModel($model);
if (method_exists($object, $method)) {
$object->{$method}($observer);
}
}
示例10: testScheduleOrderSync
/**
* @test
* @loadFixture
*/
public function testScheduleOrderSync()
{
$model = Mage::getModel("klevu_search/observer");
$order = Mage::getModel("sales/order")->load(1);
$event = new Varien_Event();
$event->addData(array("event_name" => "sales_order_place_after", "order" => $order));
$observer = new Varien_Event_Observer();
$observer->addData(array("event" => $event));
$model->scheduleOrderSync($observer);
$this->assertEquals(array(array("order_item_id" => "2")), $this->getOrderSyncQueue());
$this->assertEquals(1, $this->getOrderSyncCronScheduleCollection()->getSize(), "Failed to assert that scheduleOrderSync() schedules the Order Sync cron when called.");
}
示例11: afterOutput
/**
* Executed from the core_block_abstract_to_html_after event
* @param Varien_Event $obj
*/
public function afterOutput($obj)
{
$block = $obj->getEvent()->getBlock();
$transport = $obj->getEvent()->getTransport();
// Magento 1.3 and lower dont have this transport, so we can't do autointegration : (
if (empty($transport)) {
return $this;
}
$this->appendToSignupForm($block, $transport);
$this->appendToOnepageCheckoutSignup($block, $transport);
return $this;
}
示例12: update
/**
* @see MageUC_Developer_Bar_Panel_Interface::update(Varien_Event $event)
*/
public function update(Varien_Event $event)
{
if (!$this->_profilerEnabled) {
Mage::getSingleton('core/resource')->getConnection('core_write')->getProfiler()->setEnabled(true);
$this->_profilerEnabled = true;
}
if ($event->getName() == MageUC_Developer_Bar::EVENT_POST_DISPATCH) {
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$this->_profiler = $conn->getProfiler();
}
return;
}
示例13: afterOutput
/**
* Executed from the core_block_abstract_to_html_after event
* @param Varien_Event $obj
*/
public function afterOutput($obj)
{
$block = $obj->getEvent()->getBlock();
$transport = $obj->getEvent()->getTransport();
// Magento 1.3 and lower dont have this transport, so we can't do autointegration : (
if (empty($transport)) {
return $this;
}
$this->appendRewardsHeader($block, $transport);
$this->appendCartPointsSpender($block, $transport);
$this->appendPointsSummary($block, $transport);
return $this;
}
示例14: 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);
}
示例15: 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());
}