本文整理汇总了PHP中Varien_Event类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event类的具体用法?PHP Varien_Event怎么用?PHP Varien_Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:nicolas-bastien,项目名称:MagentoUnderControl,代码行数:10,代码来源:Log.php
示例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;
}
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:14,代码来源:Observer.php
示例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;
}
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:8,代码来源:ObjectChange.php
示例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++;
}
开发者ID:nicolas-bastien,项目名称:MagentoUnderControl,代码行数:11,代码来源:Event.php
示例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;
}
开发者ID:eniuz,项目名称:FrontendMonitoring,代码行数:14,代码来源:Observer.php
示例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);
}
开发者ID:nicolas-bastien,项目名称:MagentoUnderControl,代码行数:13,代码来源:App.php
示例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;
}
开发者ID:rajarshc,项目名称:Rooja,代码行数:14,代码来源:Grandtotal.php
示例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;
}
开发者ID:rajarshc,项目名称:Rooja,代码行数:15,代码来源:Observer.php
示例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);
}
}
开发者ID:nhp,项目名称:Xtest,代码行数:18,代码来源:Xtest.php
示例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.");
}
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:16,代码来源:Observer.php
示例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;
}
开发者ID:rajarshc,项目名称:Rooja,代码行数:16,代码来源:Register.php
示例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;
}
开发者ID:nicolas-bastien,项目名称:MagentoUnderControl,代码行数:15,代码来源:Database.php
示例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;
}
开发者ID:rajarshc,项目名称:Rooja,代码行数:17,代码来源:Output.php
示例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);
}
开发者ID:WeareJH,项目名称:esendex-magento-extension,代码行数:13,代码来源:ObserverTest.php
示例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());
}
开发者ID:mrafulfill,项目名称:firegento-magesetup,代码行数:17,代码来源:Observer.php
示例16: 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
示例17: setOrderCurrency
/**
* handles the event checkout_type_onepage_save_order to set the currency of the order
* @param Varien_Event $event
*/
public function setOrderCurrency($event)
{
if (Mage::helper('imagecc')->isActive()) {
$order = $event->getOrder();
if ($order && !Mage::helper('imagecc')->isPaypalOrder($order)) {
if ($this->_useFixedCurrency($order)) {
return;
}
Mage::helper('imagecc')->log("Using display currency " . $order->getIncrementId());
$imagecc_preserved_information = array('order_fields' => array(), 'item_fields' => array());
$_coreHelper = Mage::helper('core');
foreach ($this->_orderFields as $field) {
$field2 = preg_replace('(^base_)', '', $field);
$new_v = $order->getData($field2);
//$v = $order->getData($field);
//$new_v = $_coreHelper->currency($v, false, false);
/**
* preserve information before change it
*/
if ($field !== $field2) {
$imagecc_preserved_information['order_fields'][] = array('field' => $field, 'original_value' => $order->getData($field), 'new_value' => $new_v);
}
$order->setData($field, $new_v);
Mage::helper('imagecc')->log("{$field2} {$field} {$new_v}");
}
foreach ($order->getAllItems() as $item) {
$arr = $this->_itemFields;
$quoteItemId = $item->getData('quote_item_id');
$imagecc_preserved_information['item_fields'][$quoteItemId] = array();
foreach ($arr as $k) {
//$v = $item->getData($k);
//$new_v = $_coreHelper->currency($v, false, false);
$field2 = preg_replace('(^base_)', '', $k);
$new_v = $item->getData($field2);
/**
* preserve information before change it
*/
if ($k !== $field2) {
$imagecc_preserved_information['item_fields'][$quoteItemId][] = array('field' => $k, 'original_value' => $item->getData($k), 'new_value' => $new_v);
}
$item->setData($k, $new_v);
Mage::helper('imagecc')->log("{$field2} {$k} {$new_v}");
}
//$item->save();
}
$store_currency = $order->getData('order_currency_code');
/**
* preserve information before change it
*/
$imagecc_preserved_information['order_fields']['global_currency_code'] = array('original_value' => $order->getData('global_currency_code'), 'field' => 'global_currency_code', 'new_value' => '');
$imagecc_preserved_information['order_fields']['base_currency_code'] = array('original_value' => $order->getData('base_currency_code'), 'field' => 'base_currency_code', 'new_value' => '');
$imagecc_preserved_information['order_fields']['store_currency_code'] = array('original_value' => $order->getData('store_currency_code'), 'field' => 'store_currency_code', 'new_value' => '');
$order->setData('global_currency_code', $store_currency)->setData('base_currency_code', $store_currency)->setData('store_currency_code', $store_currency)->setData('imagecc_preserved_information', json_encode($imagecc_preserved_information));
}
}
}
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:60,代码来源:Intellimage_CurrencyCheckout_Model_Observer.php
示例18: addEvent
/**
* Register an event for this collection
*
* @param Varien_Event $event
* @return Varien_Event_Collection
*/
public function addEvent(Varien_Event $event)
{
$this->_events[$event->getName()] = $event;
return $this;
}
开发者ID:natxetee,项目名称:magento2,代码行数:11,代码来源:Collection.php
示例19: dispatchEvent
public function dispatchEvent($eventName, $args)
{
$eventName = strtolower($eventName);
foreach ($this->_events as $area => $events) {
if (!isset($events[$eventName])) {
$eventConfig = $this->getConfig()->getEventConfig($area, $eventName);
if (!$eventConfig) {
$this->_events[$area][$eventName] = false;
continue;
}
$observers = array();
foreach ($eventConfig->observers->children() as $obsName => $obsConfig) {
$observers[$obsName] = array('type' => (string) $obsConfig->type, 'model' => $obsConfig->class ? (string) $obsConfig->class : $obsConfig->getClassName(), 'method' => (string) $obsConfig->method, 'args' => (array) $obsConfig->args);
}
$events[$eventName]['observers'] = $observers;
$this->_events[$area][$eventName]['observers'] = $observers;
}
if (false === $events[$eventName]) {
continue;
} else {
$event = new Varien_Event($args);
$event->setName($eventName);
$observer = new Varien_Event_Observer();
}
foreach ($events[$eventName]['observers'] as $obsName => $obs) {
$observer->setData(array('event' => $event));
Varien_Profiler::start('OBSERVER: ' . $obsName);
switch ($obs['type']) {
case 'disabled':
break;
case 'object':
case 'model':
$method = $obs['method'];
$observer->addData($args);
$object = Mage::getModel($obs['model']);
$this->_callObserverMethod($object, $method, $observer);
break;
default:
$method = $obs['method'];
$observer->addData($args);
$object = Mage::getSingleton($obs['model']);
$this->_callObserverMethod($object, $method, $observer);
break;
}
Varien_Profiler::stop('OBSERVER: ' . $obsName);
}
}
return $this;
}
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:49,代码来源:App.php
示例20: testBillingAddressIsNull
/**
* add DHL account to shipment create request
*
* @test
* @loadFixture ../../../../../Intraship/Test/var/fixtures/shipments
* @loadFixture ../../../../../Intraship/Test/var/fixtures/parcels
*/
public function testBillingAddressIsNull()
{
$shipment = Mage::getModel('intraship/shipment')->load(10);
$event = new Varien_Event();
$event->setObject($shipment);
Mage::getModel('dhlaccount/observer')->dhlIntrashipShipmentLoadAfter($event);
$this->assertFalse($shipment->hasCustomizedAddress());
// parcel announcement
$shipment = Mage::getModel('intraship/shipment')->load(1);
$event = new Varien_Event();
$shipment->getShipment()->getBillingAddress()->setDhlaccount('123');
$event->setObject($shipment);
Mage::getModel('dhlaccount/observer')->dhlIntrashipShipmentLoadAfter($event);
$this->assertTrue(is_array($shipment->getCustomerAddress()));
$customerAddress = $shipment->getCustomerAddress();
$this->assertTrue(array_key_exists('dhlaccount', $customerAddress));
$this->assertEquals('123', $customerAddress['dhlaccount']);
// packstation
$event = new Varien_Event();
$shipment->getShipment()->getShippingAddress()->setDhlaccount('567');
$shipment->getShipment()->getShippingAddress()->setStreet('123');
$event->setObject($shipment);
Mage::getModel('dhlaccount/observer')->dhlIntrashipShipmentLoadAfter($event);
$this->assertTrue(is_array($shipment->getCustomerAddress()));
$customerAddress = $shipment->getCustomerAddress();
$this->assertTrue(array_key_exists('id_number', $customerAddress));
$this->assertEquals('567', $customerAddress['id_number']);
$this->assertTrue(array_key_exists('station_id', $customerAddress));
$this->assertEquals('123', $customerAddress['station_id']);
}
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:37,代码来源:ObserverTest.php
注:本文中的Varien_Event类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论