本文整理匯總了PHP中Varien_Event_Observer::getEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Event_Observer::getEvent方法的具體用法?PHP Varien_Event_Observer::getEvent怎麽用?PHP Varien_Event_Observer::getEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getEvent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SendSmsOrderStatusChange
public function SendSmsOrderStatusChange(Varien_Event_Observer $observer)
{
$orderID = $observer->getOrder()->getIncrementId();
$msisdn = $observer->getOrder()->getBillingAddress()->getTelephone();
// Customer Mobile No
$status = $observer->getEvent()->getOrder()->getStatus();
$state = $observer->getEvent()->getOrder()->getState();
$paymethod = $observer->getEvent()->getOrder()->getPayment()->getMethodInstance()->getCode();
//START check status & generated SMS Code here your code
$sms = '';
if (!empty($status)) {
if ($status == 'pending' && ($paymethod == 'cashondelivery' || $paymethod == 'checkmo')) {
$sms = 'Your submitted order (#' . $orderID . ') is now in Pending status. Thank You.@SSLW';
} else {
if ($status == 'processing') {
$sms = 'Your invoice is generated. We are processing your order (#' . $orderID . '). Please keep patience.@SSLW';
} else {
if ($status == 'complete') {
$sms = 'Your order (#' . $orderID . ') is now on Delivery process. Soon you will receive your order.@SSLW';
} else {
exit;
}
}
}
// ALL Other status condition will be here..
//START SMS API Code here your code
//$msisdn2='0171767xxxx'; // Store Admin Mobile No
//$sms = 'Congrats! You have successfully Register. Thank You.@SSLW'; //May Change SMS Body here
if (!empty($sms)) {
$user = "UserID";
$pass = "UserPassword";
//if change login password isms.sslwireless.com then change new here
$sid = "StakeHolderName";
//Stake Holder Name here
$url = "http://sms.sslwireless.com/pushapi/dynamic/server.php";
$unique_id_1 = uniqid();
$unique_id_2 = uniqid();
$param = "user={$user}&pass={$pass}&sid={$sid}&";
$sms = "sms[0][0]={$msisdn}&sms[0][1]=" . urlencode($sms) . "&sms[0][2]=" . $unique_id_1 . "&sms[1][0]={$msisdn2}&sms[1][1]=" . urlencode($sms) . "&sms[1][2]=" . $unique_id_2 . "";
$data = $param . $sms . $sid;
$crl = curl_init();
curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($crl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_HEADER, 0);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_POST, 1);
curl_setopt($crl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($crl);
curl_close($crl);
//echo $response;
}
//end sms body check
//END SMS API Code here your code
}
//End status Code here your code
/* else {
$sms = 'Dear customer, thank you for shopping online. Your Order ID is #'.$orderID.'. @PURNAVA.';
}*/
}
示例2: prepareProductSave
/**
* Prepare product to save
*
* @param Varien_Object $observer
* @return Iksanika_Productupdater_Model_Observer
*/
public function prepareProductSave(Varien_Event_Observer $observer)
{
$request = $observer->getEvent()->getRequest();
$product = $observer->getEvent()->getProduct();
// not dispatched by some reasons ???
return $this;
}
示例3: copyHubSpotUtk
/**
* Updates the Hubspot User Token (UTK) if the cookie exists
*
* Event: sales_convert_quote_to_order
*
* @param Varien_Event_Observer $observer
* @return Eyemagine_HubSpot_Model_Observer
*/
public function copyHubSpotUtk(Varien_Event_Observer $observer)
{
$quote = $observer->getEvent()->getQuote();
$order = $observer->getEvent()->getOrder();
$order->setHubspotUserToken($quote->getHubspotUserToken());
return $this;
}
示例4: changeOnepageCheckout
/**
* Change standard OnePage checkout with One Click Order checkout
* @param Varien_Event_Observer $observer
* @return Smasoft_Oneclickorder_Model_Observer
*/
public function changeOnepageCheckout(Varien_Event_Observer $observer)
{
switch ($observer->getEvent()->getName()) {
case 'controller_action_layout_generate_blocks_after':
/** @var $action Mage_Core_Controller_Varien_Action */
$action = $observer->getEvent()->getAction();
/** @var $layout Mage_Core_Model_Layout */
$layout = $observer->getEvent()->getLayout();
if ($action->getFullActionName() == 'checkout_cart_index' && $this->_helper()->isEnabled() && $this->_helper()->isChangeOnepageCheckout()) {
$block = $layout->getBlock('checkout.cart.methods');
if ($block && $block instanceof Mage_Core_Block_Abstract) {
$block->unsetChild('checkout.cart.methods.onepage');
}
$block = $layout->getBlock('checkout.cart.top_methods');
if ($block && $block instanceof Mage_Core_Block_Abstract) {
$block->unsetChild('checkout.cart.methods.onepage');
}
}
break;
case 'controller_action_predispatch_checkout_onepage_index':
if ($this->_helper()->isEnabled() && $this->_helper()->isChangeOnepageCheckout()) {
/** @var $action Mage_Core_Controller_Varien_Action */
$action = $observer->getEvent()->getControllerAction();
if ($action) {
$action->getResponse()->setRedirect(Mage::getUrl('checkout/cart/index'));
}
}
break;
}
return $this;
}
示例5: processCartUpdateBefore
/**
* Check move quote item to wishlist request
*
* @param Varien_Event_Observer $observer
* @return Mage_Wishlist_Model_Observer
*/
public function processCartUpdateBefore($observer)
{
$cart = $observer->getEvent()->getCart();
$data = $observer->getEvent()->getInfo();
$productIds = array();
$wishlist = $this->_getWishlist($cart->getQuote()->getCustomerId());
if (!$wishlist) {
return $this;
}
/**
* Collect product ids marked for move to wishlist
*/
foreach ($data as $itemId => $itemInfo) {
if (!empty($itemInfo['wishlist'])) {
if ($item = $cart->getQuote()->getItemById($itemId)) {
$productId = $item->getProductId();
$productIds[] = $productId;
$cart->getQuote()->removeItem($itemId);
}
}
}
if (!empty($productIds)) {
foreach ($productIds as $productId) {
$wishlist->addNewItem($productId);
}
$wishlist->save();
}
return $this;
}
示例6: currencyDisplayOptions
/**
* Generate options for currency displaying with custom currency symbol
*
* @param Varien_Event_Observer $observer
* @return Mage_CurrencySymbol_Model__Observer
*/
public function currencyDisplayOptions(Varien_Event_Observer $observer)
{
$baseCode = $observer->getEvent()->getBaseCode();
$currencyOptions = $observer->getEvent()->getCurrencyOptions();
$currencyOptions->setData(Mage::helper('currencysymbol')->getCurrencyOptions($baseCode));
return $this;
}
示例7: _afterCreditmemoSave
public function _afterCreditmemoSave(Varien_Event_Observer $event)
{
$base_path = Mage::getBaseDir('base');
$orgin_string = str_replace(PHP_EOL, '', file_get_contents($base_path . "/app/code/local/Nextorder/Refundbanking/Helper/sepaCheck.txt"));
if ($orgin_string == 0) {
return true;
} else {
$incrementCreditID = $event->getEvent()->getDataObject()->getCreditmemo()->getIncrementId();
if (file_exists($base_path . "/media/Sepa_Gutschrift/" . $incrementCreditID . ".xml")) {
// Mage::log( "it works!!!!!!!!!!!: test ", null, 'xulin.log');
return true;
} else {
$adminUser = Mage::getSingleton('admin/session')->getUser()->getUsername();
// $order = $event->getEvent()->getOrder();
$Grand_Total = $event->getEvent()->getDataObject()->getCreditmemo()->getData('grand_total');
// $Base_Total = $event->getEvent()->getDataObject()->getCreditmemo()->getData('base_grand_total');
// Mage::log($event->getEvent()->getDataObject()->getCreditmemo()->getData() , null, 'xulin.log');
$helper = Mage::helper("refundbanking/data");
$orderNr = $event->getEvent()->getDataObject()->getCreditmemo()->getData('order_id');
$order = Mage::getModel('sales/order')->load($orderNr);
$payment_code = $order->getPayment()->getMethodInstance()->getCode();
$paymentPools = array('ops_cc', 'paypal_billing_agreement', 'paypal_express');
// Mage::log( "it works +1", null, 'xulin.log');
if ($helper->isConfig($payment_code)) {
$kontoInfos_shop = $helper->getKontonForRefund($payment_code);
$customer = Mage::getModel('customer/customer')->load($order->getData('customer_id'));
$urlForXML = $helper->getSepaXML($customer->getData('debit_payment_acount_name'), $customer->getId(), $customer->getData('debit_payment_account_iban'), $customer->getData('debit_payment_account_swift'), $kontoInfos_shop['inhaber'], $kontoInfos_shop['iban'], $kontoInfos_shop['bic'], $order->getIncrementId(), $incrementCreditID, $Grand_Total);
Mage::getSingleton('adminhtml/session')->addSuccess("Sepa XML Gutschrit ist von User " . $adminUser . " erstellt.<a href='" . str_replace('index.php/', '', Mage::getUrl()) . "media/Sepa_Gutschrift/" . $incrementCreditID . ".xml' download> Zum Download </a>");
$event->getEvent()->getDataObject()->getCreditmemo()->addComment("Sepa XML Gutschrit ist von User " . $adminUser . " erstellt.<a href='" . str_replace('index.php/', '', Mage::getUrl()) . "media/Sepa_Gutschrift/" . $incrementCreditID . ".xml' download> Zum Download </a>", true, true);
}
}
}
}
示例8: SendSmsOrderStatusChange
public function SendSmsOrderStatusChange(Varien_Event_Observer $observer)
{
$orderID = $observer->getOrder()->getIncrementId();
$msisdn = $observer->getOrder()->getBillingAddress()->getTelephone();
// Customer Mobile No
$status = $observer->getEvent()->getOrder()->getStatus();
$state = $observer->getEvent()->getOrder()->getState();
//START SMS API Code here your code
//$msisdn2='0171767xxxx'; // Store Admin Mobile No
$sms = 'The status of your OrderID #' . $orderID . ' changed to In ' . $status . '. Thank You @SSLW';
//May Change SMS Body here
$user = "UserID";
$pass = "UserPassword";
//if change login password isms.sslwireless.com then change new here
$sid = "StakeHolderName";
//Stake Holder Name here
$url = "http://sms.sslwireless.com/pushapi/dynamic/server.php";
$unique_id_1 = uniqid();
$unique_id_2 = uniqid();
$param = "user={$user}&pass={$pass}&sid={$sid}&";
$sms = "sms[0][0]={$msisdn}&sms[0][1]=" . urlencode($sms) . "&sms[0][2]=" . $unique_id_1 . "&sms[1][0]={$msisdn2}&sms[1][1]=" . urlencode($sms) . "&sms[1][2]=" . $unique_id_2 . "";
$data = $param . $sms . $sid;
$crl = curl_init();
curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($crl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_HEADER, 0);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_POST, 1);
curl_setopt($crl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($crl);
curl_close($crl);
//echo $response;
//ENd SMS API Code here your code
}
示例9: associateItemWithProduct
public function associateItemWithProduct(Varien_Event_Observer $observer)
{
try {
$sku = $observer->getEvent()->getData('sku');
$accountId = (int) $observer->getEvent()->getData('account_id');
$marketplaceId = (int) $observer->getEvent()->getData('marketplace_id');
$productId = (int) $observer->getEvent()->getData('product_id');
/** @var $collection Mage_Core_Model_Mysql4_Collection_Abstract */
$collection = Mage::helper('M2ePro/Component_Play')->getCollection('Listing_Other');
$collection->addFieldToFilter('main_table.account_id', $accountId);
$collection->addFieldToFilter('main_table.marketplace_id', $marketplaceId);
$collection->addFieldToFilter('second_table.sku', $sku);
if ($collection->getSize() > 0 && is_null($collection->getFirstItem()->getData('product_id'))) {
/** @var $productOtherInstance Ess_M2ePro_Model_Listing_Other */
$productOtherInstance = $collection->getFirstItem();
if (!$productOtherInstance->getAccount()->getChildObject()->isOtherListingsSynchronizationEnabled() || !$productOtherInstance->getAccount()->getChildObject()->isOtherListingsMappingEnabled()) {
return;
}
$productOtherInstance->mapProduct($productId, Ess_M2ePro_Helper_Data::INITIATOR_EXTENSION);
}
} catch (Exception $exception) {
Mage::helper('M2ePro/Module_Exception')->process($exception);
return;
}
}
示例10: renderBlockPlaceholder
/**
* Render placeholder tags around the block if needed
*
* Modified to not save JS to container cache.
* Rely on the fact that JS is being moved to the end of the page
* and that the JS is not changed after initial generation.
*
* @param Varien_Event_Observer $observer
*
* @return Enterprise_PageCache_Model_Observer
*/
public function renderBlockPlaceholder(Varien_Event_Observer $observer)
{
if (!$this->_isEnabled) {
return $this;
}
$block = $observer->getEvent()->getBlock();
$transport = $observer->getEvent()->getTransport();
$placeholder = $this->_config->getBlockPlaceholder($block);
if ($transport && $placeholder && !$block->getSkipRenderTag()) {
$blockHtml = $transport->getHtml();
$request = Mage::app()->getFrontController()->getRequest();
/** @var $processor Enterprise_PageCache_Model_Processor_Default */
$processor = $this->_processor->getRequestProcessor($request);
if ($processor && $processor->allowCache($request)) {
$container = $placeholder->getContainerClass();
if ($container && !Mage::getIsDeveloperMode()) {
$container = new $container($placeholder);
$container->setProcessor(Mage::getSingleton('enterprise_pagecache/processor'));
$container->setPlaceholderBlock($block);
// Modify to not save block with JS in it as JS is being moved to the end of the page.
$footerJs = Mage::helper('meanbee_footerjs');
$container->saveCache($footerJs->removeJs($blockHtml));
}
}
$blockHtml = $placeholder->getStartTag() . $blockHtml . $placeholder->getEndTag();
$transport->setHtml($blockHtml);
}
return $this;
}
示例11: checkout_submit_all_after
/**
* If the order was placed via guest checkout, here we are still linking the order to the correct customer id based on the email
*
* @param Varien_Event_Observer $observer
*/
public function checkout_submit_all_after($observer)
{
if (!Mage::helper('anattadesign_awesomecheckout')->getConfigData('options/link_guest_orders')) {
return;
}
/** @var Mage_Sales_Model_Order $order */
$order = $observer->getEvent()->getOrder();
/** @var Mage_Sales_Model_Quote $order */
$quote = $observer->getEvent()->getQuote();
if (!$order->getCustomerId()) {
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($quote->getCustomerEmail());
if ($customer->getId()) {
$order->setCustomer($customer);
$order->setCustomerId($customer->getId());
$order->setCustomerIsGuest(false);
$order->setCustomerGroupId($customer->getGroupId());
$order->setCustomerEmail($customer->getEmail());
$order->setCustomerFirstname($customer->getFirstname());
$order->setCustomerLastname($customer->getLastname());
$order->setCustomerMiddlename($customer->getMiddlename());
$order->setCustomerPrefix($customer->getPrefix());
$order->setCustomerSuffix($customer->getSuffix());
$order->setCustomerTaxvat($customer->getTaxvat());
$order->setCustomerGender($customer->getGender());
$order->save();
}
}
}
示例12: performModulesBeforeSave
/**
* Method helps to perform verifications of segmentation rules by admin before enabling AITOC modules
*
* @param Varien_Event_Observer $observer
*/
public function performModulesBeforeSave(Varien_Event_Observer $observer)
{
$data = $observer->getEvent()->getData('data');
$aitsys = $observer->getEvent()->getData('aitsys');
foreach ($data as $moduleKey => $available) {
$module = $this->tool()->platform()->getModule($moduleKey);
if (!$module || !$module->isLicensed()) {
continue;
}
if (!(!$module->getInstall()->isInstalled() && $available)) {
continue;
}
if (!($performer = $module->getLicense()->getPerformer())) {
continue;
}
$ruler = $performer->getRuler();
if (!$ruler->checkRule('admin', null, 'all')) {
$rule = $ruler->getRule('admin');
$aitsys->addError($this->_aithelper()->__($this->_aithelper()->getErrorText('seg_config_admins_module_cant_enable'), $module->getLabel(), $rule['value'], $this->_aithelper()->getModuleLicenseUpgradeLink($module, false)));
}
if (!$ruler->checkRule('store', null, 'all')) {
$rule = $ruler->getRule('store');
$aitsys->addError($this->_aithelper()->__($this->_aithelper()->getErrorText('seg_exceed_limit'), $module->getLabel(), $rule['value'], $ruler->getStoreCount(), $this->_aithelper()->getModuleLicenseUpgradeLink($module, false)));
}
if (!$ruler->checkRule('product', null, 'all')) {
$rule = $module->getLicense()->getPerformer()->getRuler()->getRule('product');
$aitsys->addError($this->_aithelper()->__($this->_aithelper()->getErrorText('seg_exceed_limit'), $module->getLabel(), $rule['value'], $ruler->getProductCount(), $this->_aithelper()->getModuleLicenseUpgradeLink($module, false)));
}
}
return $this;
}
示例13: saveConfig
/**
* @param Varien_Event_Observer $o
*/
public function saveConfig(Varien_Event_Observer $o)
{
$store = is_null($o->getEvent()->getStore()) ? 'default' : $o->getEvent()->getStore();
if (!Mage::helper('mandrill')->useTransactionalService()) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (!Mage::helper('mandrill')->useTransactionalService()) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (!Mage::getStoreConfig('customer/address/dob_show')) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (!Mage::getStoreConfig('customer/address/dob_show', $store)) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Wishlist', $store)) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Review', $store)) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
}
示例14: saveDiscountTotalForMultishipping
public function saveDiscountTotalForMultishipping(Varien_Event_Observer $observer)
{
$order = $observer->getEvent()->getOrder();
$address = $observer->getEvent()->getAddress();
$order->setData('discount_total', $shippingAddress->getData('discount_total'));
$order->save();
}
示例15: saveFields
public function saveFields(Varien_Event_Observer $observer)
{
$model = $observer->getEvent()->getPage();
$request = $observer->getEvent()->getRequest();
if (isset($_FILES['image']['name']) && $_FILES['image']['name'] != '') {
try {
$uploader = new Mage_Core_Model_File_Uploader('image');
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
$dirPath = Mage::getBaseDir('media') . DS . 'page' . DS;
$result = $uploader->save($dirPath, $_FILES['image']['name']);
} catch (Exception $e) {
Mage::log($e->getMessage());
}
$model->setImage('page/' . $result['file']);
} else {
$data = $request->getPost();
if (isset($data['image']) && isset($data['image']['delete']) && $data['image']['delete'] == 1) {
$model->setImage(false);
} elseif (isset($data['image']) && is_array($data['image'])) {
$model->setImage($data['image']['value']);
}
}
if (empty($model->getPageType())) {
$model->setPageType(null);
}
}