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


PHP Varien_Object::getEvent方法代码示例

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


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

示例1: checkoutProcessWrappingInfo

 /**
  * Process gift wrapping options on checkout proccess
  *
  * @param Varien_Object $observer
  * @return Enterprise_GiftWrapping_Model_Observer
  */
 public function checkoutProcessWrappingInfo($observer)
 {
     $request = $observer->getEvent()->getRequest();
     $giftWrappingInfo = $request->getParam('giftwrapping');
     if (is_array($giftWrappingInfo)) {
         $quote = $observer->getEvent()->getQuote();
         $giftOptionsInfo = $request->getParam('giftoptions');
         foreach ($giftWrappingInfo as $entityId => $data) {
             $info = array();
             if (!is_array($giftOptionsInfo) || empty($giftOptionsInfo[$entityId]['type'])) {
                 continue;
             }
             switch ($giftOptionsInfo[$entityId]['type']) {
                 case 'quote':
                     $entity = $quote;
                     $this->_saveOrderInfo($entity, $data);
                     break;
                 case 'quote_item':
                     $entity = $quote->getItemById($entityId);
                     $this->_saveItemInfo($entity, $data);
                     break;
                 case 'quote_address':
                     $entity = $quote->getAddressById($entityId);
                     $this->_saveOrderInfo($entity, $data);
                     break;
                 case 'quote_address_item':
                     $entity = $quote->getAddressById($giftOptionsInfo[$entityId]['address'])->getItemById($entityId);
                     $this->_saveItemInfo($entity, $data);
                     break;
             }
         }
     }
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:40,代码来源:Observer.php

示例2: salesEventConvertQuoteToOrder

 /**
  * If the quote has a delivery note then lets save that note and 
  * assign the id to the order
  * 
  * @param Varien_Object $observer
  * @return Dh_Deliverynote_Model_Observer
  */
 public function salesEventConvertQuoteToOrder($observer)
 {
     if ($note = $observer->getEvent()->getQuote()->getDeliveryNote()) {
         $deliveryNote = Mage::getModel('deliverynote/note')->setNote($note)->save();
         $observer->getEvent()->getOrder()->setDeliveryNoteId($deliveryNote->getDeliveryNoteId());
     }
     return $this;
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:15,代码来源:Observer.php

示例3: beforeProductSave

 /**
  * set accessories for save
  * @access public
  * @param Varien_Object $observer
  * @return Anais_Accessories_Model_Observer
  * @author Marius Strajeru <marius.strajeru@anais-it.com>
  */
 public function beforeProductSave($observer)
 {
     $product = $observer->getEvent()->getProduct();
     $links = $observer->getEvent()->getRequest()->getPost('links');
     if (isset($links['accessories']) && !$product->getAccessoriesReadonly()) {
         $product->setAccessoriesLinkData(Mage::helper('adminhtml/js')->decodeGridSerializedInput($links['accessories']));
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:16,代码来源:Observer.php

示例4: convertPayment

 /**
  * Convert specific attributes from Quote Payment to Order Payment
  *
  * @param Varien_Object $observer
  * @return Mage_Ideal_Model_Observer
  */
 public function convertPayment($observer)
 {
     $orderPayment = $observer->getEvent()->getOrderPayment();
     $quotePayment = $observer->getEvent()->getQuotePayment();
     $orderPayment->setIdealIssuerId($quotePayment->getIdealIssuerId());
     if ($quotePayment->getIdealIssuerId()) {
         $issuerList = unserialize($quotePayment->getIdealIssuerList());
         if (isset($issuerList[$quotePayment->getIdealIssuerId()])) {
             $orderPayment->setIdealIssuerTitle($issuerList[$quotePayment->getIdealIssuerId()]);
         }
     }
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:19,代码来源:Observer.php

示例5: deleteProductItem

 /**
  * Delete product item from Google Content
  *
  * @param Varien_Object $observer
  * @return BlueVisionTec_GoogleShoppingApi_Model_Observer
  */
 public function deleteProductItem($observer)
 {
     $product = $observer->getEvent()->getProduct();
     $items = $this->_getItemsCollection($product);
     Mage::getModel('googleshoppingapi/massOperations')->deleteItems($items);
     return $this;
 }
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:13,代码来源:Observer.php

示例6: checkFacebookSettings

 /**
  * Runs before the customer behavior rule is saved to check the evlike settings.
  * @param Varien_Object $o
  */
 public function checkFacebookSettings($o)
 {
     $event = $o->getEvent();
     $this->setRequest($o->getControllerAction()->getRequest());
     $this->setResponse($o->getControllerAction()->getResponse());
     $post_data = $this->getRequest()->getPost();
     if (empty($post_data)) {
         return $this;
     }
     if ($post_data['points_conditions'] != TBT_Rewardssocial_Model_Facebook_Like_Special_Config::ACTION_CODE) {
         return $this;
     }
     $rewards_wiki_url = "https://sweettoothrewards.com/wiki/index.php/Sweet_Tooth_Facebook";
     if (!Mage::helper('rewardssocial/facebook_evlike')->isEvlikeEnabled()) {
         $msg = Mage::helper('rewardssocial')->__("The Facebook Like Module by Retail Evolved has not been installed or is disabled. It is required to reward customers for liking products on Facebook with Sweet Tooth. For more information, please [rewards_wiki_facebook_link]visit this help article[/rewards_wiki_facebook_link]. Your rule was still saved.");
         $msg = Mage::helper('rewardssocial')->getTextWithLinks($msg, 'rewards_wiki_facebook_link', $rewards_wiki_url, array('target' => '_wiki_sweet_tooth_facebook'));
         Mage::getSingleton('core/session')->addError($msg);
         return $this;
     }
     if (!Mage::helper('rewardssocial/facebook_evlike')->isEvlikeValidRewardsConfig()) {
         $evlike_config_url = Mage::helper('rewardssocial/facebook_evlike')->getConfigUrl();
         $msg = Mage::helper('rewardssocial')->__("The Facebook Like Module by Retail Evolved has not been configured properly.  Please visit the [evlike_config_link]Retail Evolved Facebook Like configuration[/evlike_config_link] section and change the Button Type to 'XFBML' or [rewards_wiki_facebook_link]visit this help article[/rewards_wiki_facebook_link]. Your rule was still saved.");
         $msg = Mage::helper('rewardssocial')->getTextWithLinks($msg, 'evlike_config_link', $evlike_config_url);
         $msg = Mage::helper('rewardssocial')->getTextWithLinks($msg, 'rewards_wiki_facebook_link', $rewards_wiki_url, array('target' => '_wiki_sweet_tooth_facebook'));
         Mage::getSingleton('core/session')->addError($msg);
         return $this;
     }
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:33,代码来源:Observer.php

示例7: customerDeleted

 /**
  * Customer delete handler
  *
  * @param Varien_Object $observer
  * @return Mage_Newsletter_Model_Observer
  */
 public function customerDeleted($observer)
 {
     $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($observer->getEvent()->getCustomer()->getEmail());
     if ($subscriber->getId()) {
         $subscriber->delete();
     }
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:14,代码来源:Observer.php

示例8: deleteProductItem

 /**
  * Delete product item from Google Content
  *
  * @param Varien_Object $observer
  * @return Mage_GoogleShopping_Model_Observer
  */
 public function deleteProductItem($observer)
 {
     $product = $observer->getEvent()->getProduct();
     $items = $this->_getItemsCollection($product);
     try {
         Mage::getModel('Mage_GoogleShopping_Model_MassOperations')->deleteItems($items);
     } catch (Zend_Gdata_App_CaptchaRequiredException $e) {
         Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError('Cannot delete Google Content Item. Google requires CAPTCHA.');
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:17,代码来源:Observer.php

示例9: deleteProductItem

 /**
  * Delete product item from Google Content
  * @dispatch catalog_product_delete_before
  *
  * @param Varien_Object $observer
  *
  * @return Zookal_GShoppingV2_Model_Observer
  */
 public function deleteProductItem($observer)
 {
     $product = $observer->getEvent()->getProduct();
     $items = $this->_getItemsCollection($product);
     try {
         Mage::getModel('gshoppingv2/massOperations')->deleteItems($items);
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError('Cannot delete Google Content Item. Google requires CAPTCHA.');
     }
     return $this;
 }
开发者ID:rsquarem,项目名称:MageGoogleShoppingApiV2,代码行数:19,代码来源:Observer.php

示例10: setLinkStatus

 /**
  * Set status of link
  *
  * @param Varien_Object $observer
  * @return Mage_Downloadable_Model_Observer
  */
 public function setLinkStatus($observer)
 {
     $order = $observer->getEvent()->getOrder();
     if (!$order->getId()) {
         //order not saved in the database
         return $this;
     }
     /* @var $order Mage_Sales_Model_Order */
     $status = '';
     $orderItemsIds = array();
     $orderItemStatusToEnable = Mage::getStoreConfig(Mage_Downloadable_Model_Link_Purchased_Item::XML_PATH_ORDER_ITEM_STATUS, $order->getStoreId());
     if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
         $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING;
     } elseif ($order->isCanceled() || $order->getState() == Mage_Sales_Model_Order::STATE_CLOSED) {
         $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED;
     } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
         $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING_PAYMENT;
     } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
         $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PAYMENT_REVIEW;
     } else {
         $availableStatuses = array($orderItemStatusToEnable, Mage_Sales_Model_Order_Item::STATUS_INVOICED);
         foreach ($order->getAllItems() as $item) {
             if ($item->getProductType() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE || $item->getRealProductType() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) {
                 if (in_array($item->getStatusId(), $availableStatuses)) {
                     $orderItemsIds[] = $item->getId();
                 }
             }
         }
         if ($orderItemsIds) {
             $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE;
         }
     }
     if (!$orderItemsIds && $status) {
         foreach ($order->getAllItems() as $item) {
             if ($item->getProductType() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE || $item->getRealProductType() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) {
                 $orderItemsIds[] = $item->getId();
             }
         }
     }
     if ($orderItemsIds) {
         $linkPurchased = Mage::getResourceModel('downloadable/link_purchased_item_collection')->addFieldToFilter('order_item_id', array('in' => $orderItemsIds));
         foreach ($linkPurchased as $link) {
             if ($link->getStatus() != Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED && $link->getStatus() != ICC_Ecodes_Helper_Downloadable::LINK_STATUS_REFUNDED) {
                 $link->setStatus($status)->save();
             }
         }
     }
     return $this;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:55,代码来源:ICC_Downloadable_Model_Observer.php

示例11: banClientEsiCache

 /**
  * Clear the ESI block cache for a specific client
  *
  * Events:
  *     the events are applied dynamically according to what events are set
  *     for the various blocks' esi policies
  *
  * @param  Varien_Object $eventObject
  * @return null
  */
 public function banClientEsiCache($eventObject)
 {
     $eventName = $eventObject->getEvent()->getName();
     if (Mage::helper('turpentine/esi')->getEsiEnabled() && !in_array($eventName, $this->_esiClearFlag)) {
         $sessionId = Mage::app()->getRequest()->getCookie('frontend');
         if ($sessionId) {
             $result = $this->_getVarnishAdmin()->flushExpression('obj.http.X-Varnish-Session', '==', $sessionId, '&&', 'obj.http.X-Turpentine-Flush-Events', '~', $eventName);
             Mage::dispatchEvent('turpentine_ban_client_esi_cache', $result);
             if ($this->_checkResult($result)) {
                 Mage::helper('turpentine/debug')->logDebug('Cleared ESI cache for client (%s) on event: %s', $sessionId, $eventName);
             } else {
                 Mage::helper('turpentine/debug')->logWarn('Failed to clear Varnish ESI cache for client: %s', $sessionId);
             }
         }
         $this->_esiClearFlag[] = $eventName;
     }
 }
开发者ID:technomagegithub,项目名称:colb2b,代码行数:27,代码来源:Ban.php

示例12: run

    /**
     * Run script
     *
     */
    public function run()
    {
        if($this->getArg('item') && ctype_digit($this->getArg('item'))) {
            echo "Loading sales order item " . $this->getArg('item') . '...' . PHP_EOL;
            $item = Mage::getModel('sales/order_item')->load($this->getArg('item'));
            if($item->getId() == $this->getArg('item')) {

                // Check if link already exists.  If yes, just return
                if(Mage::getModel('downloadable/link_purchased')->load($item->getId(), 'order_item_id')->getId()) {
                    echo "Link already exists for this item." . PHP_EOL;
                    return;
                }

                // Save downloadable link for order item
                $param = new Varien_Object( array(
                    'event' => new Varien_Object(array(
                            'item' => $item
                            )
                        )
                    ));

                if($param->getEvent()->getItem()->getId()) {
                    echo "Saving link..." . PHP_EOL;

                    Mage::getModel('downloadable/observer')
                        ->saveDownloadableOrderItem($param);

                    echo "Done. " . PHP_EOL . PHP_EOL;
                    echo "If this operation was unsuccessful, please check the order item id product_options. If the serialized links array is empty, then first fix it and try again. ". PHP_EOL;
                    echo "For example, if the product option has ...:5:\"links\";a:0:{}..., update with the link id such as ...:5:\"links\";a:1:{i:0;s:4:\"7647\";}..." . PHP_EOL;
                    echo "Then re-run this script. " . PHP_EOL;
                }
            }
            else {
                echo "Sales order item not found";
            }
        }
        else {
            echo $this->usageHelp();
        }


    }
开发者ID:ankita-parashar,项目名称:magento,代码行数:47,代码来源:restore_missing_downloadable_link.php

示例13: deleteProductItem

 /**
  * Delete product item from Google Base
  *
  * @param Varien_Object $observer
  * @return Mage_GoogleBase_Model_Observer
  */
 public function deleteProductItem($observer)
 {
     try {
         $product = $observer->getEvent()->getProduct();
         if (Mage::getStoreConfigFlag('google/googlebase/observed', $product->getStoreId())) {
             $collection = Mage::getResourceModel('googlebase/item_collection')->addProductFilterId($product->getId())->load();
             foreach ($collection as $item) {
                 $item->deleteItem()->delete();
             }
         }
     } catch (Exception $e) {
         if (Mage::app()->getStore()->isAdmin()) {
             Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('googlebase')->__("Cannot update Google Base Item for Store '%s'", Mage::app()->getStore($item->getStoreId())->getName()));
         } else {
             throw $e;
         }
     }
     return $this;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:25,代码来源:Observer.php

示例14: copyQuoteFilesToOrderFiles

 /**
  * Copy quote custom option files to order custom option files
  *
  * @param Varien_Object $observer
  * @return Mage_Catalog_Model_Product_Option_Observer
  */
 public function copyQuoteFilesToOrderFiles($observer)
 {
     /* @var $quoteItem Mage_Sales_Model_Quote_Item */
     $quoteItem = $observer->getEvent()->getItem();
     if (is_array($quoteItem->getOptions())) {
         foreach ($quoteItem->getOptions() as $itemOption) {
             $code = explode('_', $itemOption->getCode());
             if (isset($code[1]) && is_numeric($code[1]) && ($option = $quoteItem->getProduct()->getOptionById($code[1]))) {
                 if ($option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FILE) {
                     /* @var $_option Mage_Catalog_Model_Product_Option */
                     try {
                         $group = $option->groupFactory($option->getType())->setQuoteItemOption($itemOption)->copyQuoteToOrder();
                     } catch (Exception $e) {
                         continue;
                     }
                 }
             }
         }
     }
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:27,代码来源:Observer.php

示例15: _OSCSaveBilling


//.........这里部分代码省略.........
                 if (!empty($billing_data['customer_password']) && !empty($billing_data['confirm_password']) && $billing_data['customer_password'] == $billing_data['confirm_password']) {
                     $password = $billing_data['customer_password'];
                     $this->getOnepage()->getQuote()->setCheckoutMethod('register');
                     $this->getOnepage()->getQuote()->getCustomer()->setData('password', $password);
                     $this->getOnepage()->getQuote()->setData('customer_email', $billing_data['email']);
                     $this->getOnepage()->getQuote()->setData('customer_firstname', $billing_data['firstname']);
                     $this->getOnepage()->getQuote()->setData('customer_lastname', $billing_data['lastname']);
                     $this->getOnepage()->getQuote()->setData('password_hash', Mage::getModel('customer/customer')->encryptPassword($password));
                 }
             }
             if (!empty($billing_data['customer_password']) && !empty($billing_data['confirm_password'])) {
                 // Trick to allow saving of
                 Mage::getSingleton('checkout/type_onepage')->saveCheckoutMethod('register');
             }
         }
     }
     //Create Account hook
     if (Mage::helper('customer')->isLoggedIn() && $helper->differentShippingAvailable()) {
         if (!empty($customerAddressId)) {
             $billingAddress = Mage::getModel('customer/address')->load($customerAddressId);
             if (is_object($billingAddress) && $billingAddress->getCustomerId() == Mage::helper('customer')->getCustomer()->getId()) {
                 $billing_data = array_merge($billing_data, $billingAddress->getData());
             }
         }
         if (!empty($shippingAddressId)) {
             $shippingAddress = Mage::getModel('customer/address')->load($shippingAddressId);
             if (is_object($shippingAddress) && $shippingAddress->getCustomerId() == Mage::helper('customer')->getCustomer()->getId()) {
                 $shipping_data = array_merge($shipping_data, $shippingAddress->getData());
             }
         }
     }
     if (!empty($billing_data['use_for_shipping'])) {
         $shipping_data = $billing_data;
     }
     $this->getOnepage()->getQuote()->getBillingAddress()->addData($billing_data)->implodeStreetAddress()->setCollectShippingRates(true);
     $paymentMethod = $this->getRequest()->getPost('payment_method', false);
     $selectedMethod = $this->getOnepage()->getQuote()->getPayment()->getMethod();
     $store = $this->getOnepage()->getQuote() ? $this->getOnepage()->getQuote()->getStoreId() : null;
     $methods = $helper->getActiveStoreMethods($store, $this->getOnepage()->getQuote());
     if ($paymentMethod && !empty($methods) && !in_array($paymentMethod, $methods)) {
         $paymentMethod = false;
     }
     if (!$paymentMethod && $selectedMethod && in_array($selectedMethod, $methods)) {
         $paymentMethod = $selectedMethod;
     }
     if ($this->getOnepage()->getQuote()->isVirtual()) {
         $this->getOnepage()->getQuote()->getBillingAddress()->setPaymentMethod(!empty($paymentMethod) ? $paymentMethod : null);
     } else {
         $this->getOnepage()->getQuote()->getShippingAddress()->setPaymentMethod(!empty($paymentMethod) ? $paymentMethod : null);
     }
     try {
         if ($paymentMethod) {
             $this->getOnepage()->getQuote()->getPayment()->getMethodInstance();
         }
     } catch (Exception $e) {
     }
     //Breaks totals
     //$result = $this->getOnepage()->saveBilling($billing_data, $customerAddressId);
     if ($helper->differentShippingAvailable()) {
         if (empty($billing_data['use_for_shipping'])) {
             $shipping_result = $helper->saveShipping($shipping_data, $shippingAddressId);
         } else {
             $shipping_result = $helper->saveShipping($billing_data, $customerAddressId);
         }
     }
     $shipping_method = $this->getRequest()->getPost('shipping_method', false);
     if (!empty($shipping_method)) {
         $helper->saveShippingMethod($shipping_method);
     }
     //Commented, it breaks totals
     //$this->getOnepage()->getQuote()->setTotalsCollectedFlag(false)->collectTotals();
     $requestParams = $this->getRequest()->getParams();
     if (array_key_exists('onestepcheckout_comments', $requestParams) && !empty($requestParams['onestepcheckout_comments'])) {
         $this->getSageSuiteSession()->setOscOrderComments($requestParams['onestepcheckout_comments']);
     }
     if (Mage::getStoreConfig('onestepcheckout/feedback/enable_feedback')) {
         $feedbackValues = unserialize(Mage::getStoreConfig('onestepcheckout/feedback/feedback_values'));
         $feedbackValue = $this->getRequest()->getPost('onestepcheckout-feedback');
         $feedbackValueFreetext = $this->getRequest()->getPost('onestepcheckout-feedback-freetext');
         if (!empty($feedbackValue)) {
             if ($feedbackValue != 'freetext') {
                 $feedbackValue = $feedbackValues[$feedbackValue]['value'];
             } else {
                 $feedbackValue = $feedbackValueFreetext;
             }
             $this->getSageSuiteSession()->setOscCustomerFeedback(Mage::helper('core')->escapeHtml($feedbackValue));
         }
     }
     //GiftMessage
     $event = new Varien_Object();
     $event->setEvent(new Varien_Object());
     $event->getEvent()->setRequest($this->getRequest());
     $event->getEvent()->setQuote($this->getOnepage()->getQuote());
     Mage::getModel('giftmessage/observer')->checkoutEventCreateGiftMessage($event);
     if (array_key_exists('subscribe_newsletter', $requestParams) && (int) $requestParams['subscribe_newsletter'] === 1) {
         $this->getSageSuiteSession()->setOscNewsletterEmail($this->getOnepage()->getQuote()->getBillingAddress()->getEmail());
     }
     //GiftCard
     Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method', array('request' => $this->getRequest(), 'quote' => $this->getOnepage()->getQuote()));
 }
开发者ID:electricjesus,项目名称:sage-pay-suite-ce,代码行数:101,代码来源:PaymentController.php


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