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


PHP unknown_type::getQuote方法代码示例

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


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

示例1: loadQuoteAfter

 /**
  *
  * When load() function is called on the quote object,
  * we read our custom fields value from database and put them back in quote object.
  * @param unknown_type $evt
  */
 public function loadQuoteAfter($evt)
 {
     $quote = $evt->getQuote();
     $model = Mage::getModel('custom/custom_quote');
     $data = $model->getByQuote($quote->getId());
     foreach ($data as $key => $value) {
         $quote->setData($key, $value);
     }
 }
开发者ID:jcolas15,项目名称:mageCheckout,代码行数:15,代码来源:Observer.php

示例2: saveQuoteAfter

 /**
  * This function is called, just after $quote object get saved to database.
  * Here, after the quote object gets saved in database
  * we save our custom field in the our table created i.e sales_quote_custom
  * @param unknown_type $evt
  */
 public function saveQuoteAfter($evt)
 {
     $quote = $evt->getQuote();
     $var = $quote->getMobile();
     if (!empty($var)) {
         $model = Mage::getModel('custom/custom_quote');
         $model->deteleByQuote($quote->getId(), 'mobile');
         $model->setQuoteId($quote->getId());
         $model->setKey('mobile');
         $model->setValue($var);
         $model->save();
     }
     $var1 = $quote->getRadio();
     if (!empty($var1)) {
         $model = Mage::getModel('custom/custom_quote');
         //$model->deteleByQuote($quote->getId(),'radio');
         $model->setQuoteId($quote->getId());
         $model->setKey('radio');
         $model->setValue($var1);
         $model->save();
     }
     /*$quote = Mage::getSingleton('checkout/session')->getQuote();
     		echo $quote_id = $quote['entity_id'] ;
     		$customer = Mage::getSingleton('customer/session')->getCustomer();
     		$customer_id = $customer->getId();
     		if(Mage::getSingleton('customer/session')->isLoggedIn())  {
     	    $resource = Mage::getSingleton('core/resource');
     		$readConnection = $resource->getConnection('core_read');
     
     		$query = "SELECT * FROM ".$resource->getTableName('sales_flat_quote_address'). " WHERE customer_id= $customer_id AND quote_id= $quote_id AND address_type= 'shipping'" ;
     		$result = $readConnection->query($query) ;
     		//echo "<pre>"; print_r($result);
     		}
     		foreach($result as $r){ 
     		  //echo "<pre>"; print_r($r);
     		   $quoteshipaddr .= $r['firstname'].'/' ;
     		   $quoteshipaddr .= $r['lastname'].'/' ;
     		   $quoteshipaddr .= preg_replace('/\s+/','',$r['street']).'/' ;
     		   $quoteshipaddr .= $r['city'].'/' ;
     		   $quoteshipaddr .= $r['region'].'/' ;
     		   $quoteshipaddr .= $r['region_id'].'/' ;
     		   $quoteshipaddr .= $r['postcode'];
     		}
     		echo $quoteshipaddr; 
     		$quotearry = explode('/',$quoteshipaddr); //print_r($quotearry);
     		//Mage::getSingleton('customer/session')->setMyquoteaddr($quoteshipaddr);	
     		
     		
     		$now = time();
     		$todaysdate = date('Y-m-d h:i:s', time());
            $backday = date('Y-m-d H:i:s', strtotime('-90 days'));
     		
     		//$resource = Mage::getSingleton('core/resource');
     		//$readConnection = $resource->getConnection('core_read');
     
     	   $query1 = "select * FROM sales_flat_order where customer_id IN (Select distinct(customer_id) FROM sales_flat_order where created_at BETWEEN CAST('$backday' AS DATE) AND CAST('$tommrdate' AS DATE)) and status= 'complete' and customer_id= 40250";
               
     		$result1 = $readConnection->query($query1) ;
     		//echo "<pre>"; print_r($result1);
     		//$onecount = 0;
     		$ordercount = 0;
     		foreach($result1 as $r){ //++$onecount; echo $onecount ;
     		   //echo "<pre>"; print_r($r);
     		  $orderentityid = $r['entity_id'];
     		   //echo $r['updated_at'] ; echo "<br/>";
     		   
     		   $query2 = "SELECT * FROM ".$resource->getTableName('sales_flat_order_address'). " WHERE customer_id= $customer_id AND parent_id= $orderentityid AND address_type= 'shipping'" ; 
     			$result2 = $readConnection->query($query2) ;
     			foreach($result2 as $r2){  $quoteshipaddr = '' ;
     				//echo "<pre>"; print_r($r2);
     				$quoteshipaddr .= $r2['firstname'].'/' ;
     			   $quoteshipaddr .= $r2['lastname'].'/' ;
     			   $quoteshipaddr .= preg_replace('/\s+/','',$r2['street']).'/' ;
     			   $quoteshipaddr .= $r2['city'].'/' ;
     			   $quoteshipaddr .= $r2['region'].'/' ;
     			   $quoteshipaddr .= $r2['region_id'].'/' ;
     			   $quoteshipaddr .= $r2['postcode'];
     			   
     			   //echo $quoteshipaddr ; echo "<br/>";
     			   $ordeeaddr = explode('/',$quoteshipaddr); //print_r($ordeeaddr);
     			   
     			   $result = array_diff($quotearry, $ordeeaddr); //print_r($result);
     			   if($result == NULL && count($result) == 0){ $ordercount++;
     				  //print_r($result);
     				}
     			}
     		   
     		}
     		//echo $ordercount;	*/
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:96,代码来源:Observer.php

示例3: _collectCatalogRewardsDiscounts

 /**
  * Figure out the catalog discount and the base catlaog discount due to catalog redemption rules.
  * NOTE: THIS RETURNS A NEGATIVE NUMBER
  * @param unknown_type $address
  * @param unknown_type $item
  */
 protected function _collectCatalogRewardsDiscounts($address, $item)
 {
     $item2 = clone $item;
     $item2->setQuote($item->getQuote());
     $currency_rate = Mage::helper('rewards/price')->getCurrencyRate($item2->getQuote());
     $catalog_discount = Mage::getSingleton('rewards/redeem')->getTotalCatalogDiscount($item2);
     // If tax exists in the item data and we are supposed to discount tax and we should apply tax before the discount.
     if ($this->_discountTax($item)) {
         if (!Mage::helper('tax')->priceIncludesTax($item->getQuote()->getStore())) {
             $catalog_discount = $catalog_discount * (1 + $item->getTaxPercent() / 100);
         }
     }
     $base_catalog_discount = Mage::helper('rewards/price')->getReversedCurrencyPrice($catalog_discount, $currency_rate);
     return array($catalog_discount, $base_catalog_discount);
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:21,代码来源:Abstract.php

示例4: recalculateDiscounts

 /**
  * @author Jared Ty <jtyler@wdca.ca>
  * 
  * @param unknown_type $quote
  * @param unknown_type $address
  * @param unknown_type $item
  * @param unknown_type $rule_id
  */
 protected function recalculateDiscounts($quote, $address, $item, $rule_id)
 {
     $rule = $this->getRule($rule_id);
     $store = $item->getQuote()->getStore();
     //@nelkaake 17/03/2010 5:01:35 AM
     //@nelkaake -a 16/11/10:
     if (Mage::helper('rewards')->isBaseMageVersionAtLeast('1.4.1.0')) {
         $addrFixedCartRules = $address->getCartRules();
     }
     if (!$rule->getId()) {
         return $this;
     }
     if (!$rule->getActions()->validate($item)) {
         return $this;
     }
     Mage::getSingleton('rewards/salesrule_validator')->addItemAppliedRuleId($item, $rule_id);
     $qty = $item->getQty();
     if ($item->getParentItem()) {
         $qty *= $item->getParentItem()->getQty();
     }
     $qty = $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
     $rulePercent = min(100, $rule->getDiscountAmount());
     $discountAmount = 0;
     $baseDiscountAmount = 0;
     //@nelkaake 17/03/2010 5:09:27 AM : is this the last item?
     $all_items = $item->getQuote()->getAllItems();
     $shipping_amount = $address->getShippingAmount();
     $base_shipping_amount = $address->getBaseShippingAmount();
     $itemPrice = $item->getDiscountCalculationPrice();
     if ($itemPrice !== null) {
         $baseItemPrice = $item->getBaseDiscountCalculationPrice();
     } else {
         $itemPrice = $item->getCalculationPrice();
         $baseItemPrice = $item->getBaseCalculationPrice();
     }
     Mage::getSingleton('rewards/redeem')->refactorRedemptions($all_items, false);
     switch ($rule->getSimpleAction()) {
         case 'to_percent':
             //@nelkaake -a 16/11/10: THIS TYPE OF DISCOUNT WAS ABANDONED BY MAGENTO
             //$rulePercent = max(0, 100-$rule->getDiscountAmount());
             //no break;
         //@nelkaake -a 16/11/10: THIS TYPE OF DISCOUNT WAS ABANDONED BY MAGENTO
         //$rulePercent = max(0, 100-$rule->getDiscountAmount());
         //no break;
         case 'by_percent':
             //@mhadianfard -c 16/11/10:
             $cartRules = $this->cart_fixed_rules;
             // WDCA CODE BEGIN
             //@nelkaake -a 28/11/10: First calculate the total discount on the cart
             if (!isset($cartRules[$rule->getId()])) {
                 $totalDiscountOnCart = $this->_getTotalPercentDiscount($item, $address, $rule, $qty);
                 $cartRules[$rule->getId()] = $totalDiscountOnCart;
                 //@nelkaake -a 28/11/10: if this was a by points spent
                 if ($rule->getPointsAction() == TBT_Rewards_Model_Salesrule_Actions::ACTION_DISCOUNT_BY_POINTS_SPENT) {
                     $this->_registerPointsSpentDiscount($rule, $cartRules[$rule->getId()]);
                 }
                 $addrCartRules = is_array($address->getCartFixedRules()) ? $address->getCartFixedRules() : array();
                 $addrCartRules[$rule->getId()] = $cartRules[$rule->getId()];
                 $address->setCartFixedRules($addrCartRules);
             }
             //@nelkaake -a 28/11/10: If we've already calculated the total discount on the cart, start trying to discount per item.
             if ($cartRules[$rule->getId()] > 0) {
                 list($discountAmount, $baseDiscountAmount) = $this->_getTotalPercentDiscountOnitem($item, $address, $rule, $cartRules, $qty);
                 if (!$this->isCfrProcessed($item, $rule_id)) {
                     $cartRules[$rule->getId()] -= $baseDiscountAmount;
                     $this->setIsCfrProcessed($item, $rule_id);
                 }
             }
             // WDCA CODE END
             $this->cart_fixed_rules = $cartRules;
             $address->setCartFixedRules($cartRules);
             break;
         case 'to_fixed':
             $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
             $discountAmount = $qty * ($item->getCalculationPrice() - $quoteAmount);
             $baseDiscountAmount = $qty * ($item->getBaseCalculationPrice() - $rule->getDiscountAmount());
             break;
         case 'by_fixed':
             if ($step = $rule->getDiscountStep()) {
                 $qty = floor($qty / $step) * $step;
             }
             $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
             $discountAmount = $qty * $quoteAmount;
             $baseDiscountAmount = $qty * $rule->getDiscountAmount();
             break;
         case 'cart_fixed':
             $cartRules = $this->cart_fixed_rules;
             // WDCA CODE BEGIN
             if (Mage::helper('rewards')->isBaseMageVersionAtLeast('1.4.2')) {
                 if (empty($this->_rulesItemTotals[$rule->getId()])) {
                     Mage::throwException(Mage::helper('salesrule')->__('Item totals are not set for rule.'));
                 }
//.........这里部分代码省略.........
开发者ID:rajarshc,项目名称:Rooja,代码行数:101,代码来源:Validator.php


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