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


PHP unknown_type::getControllerAction方法代码示例

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


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

示例1: payForShippingWithPoints

 /**
  * @deprecated unused
  * Enter description here ...
  * @param unknown_type $observer
  */
 public function payForShippingWithPoints($observer)
 {
     $this->setRequest($observer->getControllerAction()->getRequest());
     $pay_for_shipping_with_points = $this->getRequest()->getParam('pay_for_shipping_with_points', '');
     if ($pay_for_shipping_with_points) {
         $quote = Mage::getSingleton('rewards/session')->getQuote();
         $shipaddr = $quote->getShippingAddress();
         $total_shipping_value = $shipaddr->getShippingAmount();
         $current_points_spending = Mage::getSingleton('rewards/session')->getPointsSpending();
         Mage::log("Paying for shipping with points...");
         $rule_ids = explode(',', $quote->getAppliedRedemptions());
         foreach ($rule_ids as $rid) {
             $salesrule = Mage::helper('rewards/transfer')->getSalesRule($rid);
             if ($salesrule->getPointsAction() != 'discount_by_points_spent') {
                 continue;
             }
             if (!$salesrule->getDiscountAmount()) {
                 continue;
             }
             // discount amount should not be empty (so we dont divide by zero)
             Mage::log("Points step according to quote is {$quote->getPointsStep()}");
             if ($salesrule->getPointsAmount() == $quote->getPointsStep()) {
                 $uses_to_zero_shipping = ceil($total_shipping_value / $salesrule->getDiscountAmount());
                 Mage::getSingleton('rewards/session')->setPointsSpending($uses_to_zero_shipping + $current_points_spending);
                 Mage::log("Added {$uses_to_zero_shipping} to existing points uage of {$current_points_spending}");
                 break;
             }
         }
     }
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:36,代码来源:Onepage.php

示例2: _locatedProductId

 /**
  * Attempts to retreive a product ID from the observer or the previously dispatch observer.
  * @param unknown_type $observer
  */
 protected function _locatedProductId($observer)
 {
     $target_product_id = null;
     $event = $observer->getEvent();
     $action = $observer->getControllerAction();
     if ($action) {
         $request = $action->getRequest();
         $target_product_id = $request->getParam("id");
         if (!$target_product_id) {
             $target_product_id = null;
         }
         //if no product id available, reset our assumption because this must be some other unrecognized request.
     }
     $product = $observer->getProduct();
     if (empty($product) && $event instanceof Varien_Event) {
         $product = $event->getProduct();
     }
     if ($product) {
         $target_product_id = $product->getEntityId();
         if (!$target_product_id) {
             $target_product_id = null;
         }
     }
     if ($target_product_id) {
         // IF a product ID was fetched, set it into the registry
         if (Mage::registry('rewards_catalogrule_apply_product_id_memory')) {
             Mage::unregister('rewards_catalogrule_apply_product_id_memory');
         }
         Mage::register('rewards_catalogrule_apply_product_id_memory', $target_product_id);
     } else {
         // IF a product ID was NOT fetched, attempt to get it from the registry
         if (Mage::registry('rewards_catalogrule_apply_product_id_memory')) {
             $target_product_id = Mage::registry('rewards_catalogrule_apply_product_id_memory');
             // After pulling it from the registry, remove it from the registry so the next immediate action does not recall this.
             Mage::unregister('rewards_catalogrule_apply_product_id_memory');
         }
     }
     return $target_product_id;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:43,代码来源:Product.php

示例3: applyRulesOnProductAfterSave

 /**
  * Updates the points that you can use on products in the catalog afer product save events.
  * @param unknown_type $observer
  */
 public function applyRulesOnProductAfterSave($observer)
 {
     $action = $observer->getControllerAction();
     $request = $action->getRequest();
     $product_id = $request->getParam("id");
     $this->updateRulesHashOnProduct($product_id);
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:12,代码来源:Observer.php

示例4: checkRedemptionCouponBefore

 /**
  * 
  * Enter description here ...
  * @param unknown_type $o
  */
 public function checkRedemptionCouponBefore($o)
 {
     $this->setRequest($o->getControllerAction()->getRequest());
     $this->setResponse($o->getControllerAction()->getResponse());
     $couponCode = (string) $this->getRequest()->getParam('coupon_code');
     //@nelkaake Changed on Saturday July 17, 2010:
     $current_customer_group_id = Mage::getSingleton('rewards/session')->getCustomer()->getGroupId();
     $current_website_id = Mage::app()->getStore()->getWebsiteId();
     $rrs = Mage::getModel('rewards/salesrule_rule')->getCollection();
     if (Mage::helper('rewards')->isBaseMageVersionAtLeast('1.4.1')) {
         $rrs->setValidationFilter($current_website_id, $current_customer_group_id, $couponCode);
     } else {
         $rrs->addFilter("coupon_code", $couponCode);
     }
     $rr = $rrs->getFirstItem();
     $is_redem = Mage::getSingleton('rewards/salesrule_actions')->isRedemptionAction($rr->getPointsAction());
     if ($is_redem) {
         if ($couponCode != $this->_getQuote()->getCouponCode()) {
             //applying redemption coupon
             $this->_redirect('rewards/cart_redeem/cartremove', array("rids" => $rr->getId()));
         }
     }
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:29,代码来源:Observer.php

示例5: attemptReferralCheck

 /**
  * Base observer method that gets called by above observer methods whenever an account is being created in the frontend.
  * @param unknown_type $o
  * @param unknown_type $subfield
  * @throws Exception
  */
 protected function attemptReferralCheck($o, $subfield = null)
 {
     try {
         //@nelkaake The customer is already logged in so there is no need to create referral links
         if (Mage::getSingleton('rewards/session')->isCustomerLoggedIn()) {
             return $this;
         }
         $code_field = 'rewards_referral';
         $email_field = 'email';
         $firstname_field = 'firstname';
         $lastname_field = 'lastname';
         $action = $o->getControllerAction();
         $request = $action->getRequest();
         $this->setRequest($request);
         $data = $request->getPost();
         //@nelkaake Added on Thursday July 8, 2010: If a subfield (like billing) is needed, use it.
         if ($subfield) {
             if (isset($data[$subfield])) {
                 $data = $data[$subfield];
             }
         }
         //@nelkaake Added on Tuesday July 5, 2010: First some failsafe checks...
         if (empty($data)) {
             throw new Exception("Dispatched an event after the customer account creation method, " . 'but no data was found in app\\code\\community\\TBT\\RewardsReferral\\Model\\Observer\\Createaccount.php ' . "in TBT_RewardsReferral_Model_Observer_Createaccount::attemptReferralCheck.", 1);
             return $this;
         }
         //@nelkaake Added on Thursday July 8, 2010: Was a code and e-mail passed?
         //@nelkaake (add) on 1/11/10: By default, use the textbox code/email.
         $use_field = true;
         if (!isset($data[$code_field])) {
             $use_field = false;
         } else {
             if (empty($data[$code_field])) {
                 $use_field = false;
             }
         }
         // If it's not set or if it's empty using the field, use the session
         if (!$use_field) {
             //@nelkaake Changed on Wednesday October 6, 2010: Change the code if the customer does
             if (Mage::helper('rewardsref/code')->getReferral()) {
                 $data[$code_field] = Mage::helper('rewardsref/code')->getReferral();
             } else {
                 $data[$code_field] = '';
                 //throw new Exception("Customer signup was detected with data, but the '{$code_field}' field was not detected.", 1);
             }
         }
         // If all the possible referral code options are empty or not set, exit the registration system.
         if (empty($data[$code_field])) {
             return $this;
         }
         if (!isset($data[$email_field])) {
             throw new Exception("Customer signup was detected with data and the 'rewards_referral', but the '{$email_field}' field was not detected.", 1);
         }
         if (!isset($data[$firstname_field])) {
             Mage::helper('rewardsref')->log("Customer '{$firstname_field}' was not detected, but other data was detected.");
             $data[$firstname_field] = ' ';
         }
         if (!isset($data[$lastname_field])) {
             Mage::helper('rewardsref')->log("Customer '{$lastname_field}' was not detected, but other data was detected.");
             $data[$lastname_field] = ' ';
         }
         //@nelkaake Added on Thursday July 8, 2010: Fetchthe required data and load the customer
         $referral_code_or_email = $data[$code_field];
         $new_customer_email = $data[$email_field];
         //@nelkaake Added on Thursday July 8, 2010: We use this method of getting the full name becuase Magento has it's own getName() logic.
         $new_customer_name = Mage::getModel('customer/customer')->setFirstname($data[$firstname_field])->setLastname($data[$lastname_field])->getName();
         // Let's make sure the referral entry is valid.
         $referral_email = Mage::helper('rewardsref/code')->parseEmailFromReferralString($referral_code_or_email);
         if ($referral_email == $new_customer_email) {
             throw new Exception("Customer with e-mail {$new_customer_email} tried to refer his/her self {$referral_email}.", 1);
         }
         Mage::helper('rewardsref/code')->setReferral($referral_code_or_email);
         Mage::helper('rewardsref')->initateSessionReferral2($new_customer_email, $new_customer_name);
     } catch (Exception $e) {
         Mage::helper('rewardsref')->log($e->getMessage());
         if ($e->getCode() != 1) {
             Mage::logException($e);
         }
     }
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:86,代码来源:Createaccount.php


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