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


PHP Mage_Sales_Model_Quote::setTotalsCollectedFlag方法代码示例

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


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

示例1: updateShippingMethod

 /**
  * Set shipping method to quote, if needed
  *
  * @param string $methodCode
  */
 public function updateShippingMethod($methodCode)
 {
     $shippingAddress = $this->_quote->getShippingAddress();
     if ($methodCode && !$this->_quote->getIsVirtual() && $shippingAddress) {
         if ($methodCode != $shippingAddress->getShippingMethod()) {
             $this->_ignoreAddressValidation();
             $shippingAddress->setShippingMethod($methodCode)->setCollectShippingRates(true);
             // Know shipping method has changed which will likely trigger
             // total changes. Ensure that totals are collected again by
             // setting the flag to false before triggering the collect.
             $this->_quote->setTotalsCollectedFlag(false)->collectTotals()->save();
         }
     }
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:19,代码来源:Checkout.php

示例2: updateOrder

 /**
  * Update order data
  *
  * @param array $data
  */
 public function updateOrder($data)
 {
     /** @var $checkout Mage_Checkout_Model_Type_Onepage */
     $checkout = Mage::getModel('checkout/type_onepage');
     $this->_quote->setTotalsCollectedFlag(true);
     $checkout->setQuote($this->_quote);
     if (isset($data['billing'])) {
         if (isset($data['customer-email'])) {
             $data['billing']['email'] = $data['customer-email'];
         }
         $checkout->saveBilling($data['billing'], 0);
     }
     if (!$this->_quote->getIsVirtual() && isset($data['shipping'])) {
         $checkout->saveShipping($data['shipping'], 0);
     }
     if (isset($data['shipping_method'])) {
         $this->updateShippingMethod($data['shipping_method']);
     }
     $this->_quote->setTotalsCollectedFlag(false);
     $this->_quote->collectTotals();
     $this->_quote->setDataChanges(true);
     $this->_quote->save();
 }
开发者ID:ksaltik,项目名称:tooldexlive,代码行数:28,代码来源:Checkout.php

示例3: createNewOrder

 /**
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return Mage_Sales_Model_Order
  */
 public function createNewOrder($quote)
 {
     $shopgateOrder = $this->getShopgateOrder();
     $convert = Mage::getModel('sales/convert_quote');
     $transaction = Mage::getModel('core/resource_transaction');
     $SgPaymentInfos = $shopgateOrder->getPaymentInfos();
     if ($quote->getCustomerId()) {
         $transaction->addObject($quote->getCustomer());
     }
     $quote->setTotalsCollectedFlag(true);
     $transaction->addObject($quote);
     if ($quote->isVirtual()) {
         $order = $convert->addressToOrder($quote->getBillingAddress());
     } else {
         $order = $convert->addressToOrder($quote->getShippingAddress());
     }
     $order->setBillingAddress($convert->addressToOrderAddress($quote->getBillingAddress()));
     if ($quote->getBillingAddress()->getCustomerAddress()) {
         $order->getBillingAddress()->setCustomerAddress($quote->getBillingAddress()->getCustomerAddress());
     }
     if (!$quote->isVirtual()) {
         $order->setShippingAddress($convert->addressToOrderAddress($quote->getShippingAddress()));
         if ($quote->getShippingAddress()->getCustomerAddress()) {
             $order->getShippingAddress()->setCustomerAddress($quote->getShippingAddress()->getCustomerAddress());
         }
     }
     $order->setPayment($convert->paymentToOrderPayment($quote->getPayment()));
     $order->getPayment()->setTransactionId($quote->getPayment()->getLastTransId());
     $order->getPayment()->setLastTransId($quote->getPayment()->getLastTransId());
     $order->setPayoneTransactionStatus($SgPaymentInfos['status']);
     foreach ($quote->getAllItems() as $item) {
         /** @var Mage_Sales_Model_Order_Item $item */
         $orderItem = $convert->itemToOrderItem($item);
         if ($item->getParentItem()) {
             $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
         }
         $order->addItem($orderItem);
     }
     $order->setQuote($quote);
     $order->setExtOrderId($quote->getPayment()->getTransactionId());
     $order->setCanSendNewEmailFlag(false);
     $order->getPayment()->setData('payone_config_payment_method_id', $this->_getMethodId());
     return $this->setOrder($order);
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:49,代码来源:Abstract.php

示例4: _setQuoteShopCoupons

 /**
  * Add coupon from this system to quote
  *
  * @param Mage_Sales_Model_Quote $quote
  * @param ShopgateCartBase       $order
  *
  * @return Mage_Sales_Model_Quote
  * @throws ShopgateLibraryException
  */
 protected function _setQuoteShopCoupons($quote, $order)
 {
     if (count($order->getExternalCoupons()) > 1) {
         throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_TOO_MANY_COUPONS);
     }
     foreach ($order->getExternalCoupons() as $coupon) {
         /* @var $coupon ShopgateShopgateCoupon */
         $couponInfos = $this->jsonDecode($coupon->getInternalInfo(), true);
         if ($order instanceof ShopgateOrder) {
             if (!$coupon->getInternalInfo()) {
                 throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_NOT_VALID, 'Field "internal_info" is empty.');
             }
             /** @var Mage_SalesRule_Model_Coupon $mageCoupon */
             if ($this->_getConfigHelper()->getIsMagentoVersionLower1410()) {
                 $mageCoupon = Mage::getModel('salesrule/rule')->load($couponInfos["coupon_id"]);
             } else {
                 $mageCoupon = Mage::getModel('salesrule/coupon')->load($couponInfos["coupon_id"]);
             }
             $count = (int) $mageCoupon->getTimesUsed();
             $count--;
             $mageCoupon->setTimesUsed($count);
             $mageCoupon->save();
         }
         $quote->setCouponCode($coupon->getCode());
         foreach ($quote->getAllAddresses() as $address) {
             $address->setCouponCode($coupon->getCode());
         }
         $quote->setTotalsCollectedFlag(false);
         $quote->collectTotals();
         if ($this->_errorOnInvalidCoupon) {
             if ($coupon->getCode() != $quote->getCouponCode()) {
                 throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_NOT_VALID, 'Code transferred by Shopgate"' . $coupon->getCode() . '" != "' . $quote->getCouponCode() . '" code in Magento');
             }
         }
         $quote->save();
     }
     return $quote;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:47,代码来源:Plugin.php

示例5: setCouponCode

 /**
  * Set the coupon code on the quote
  *
  * @param Mage_Sales_Model_Quote
  * @param $couponCode
  */
 public function setCouponCode(Mage_Sales_Model_Quote $quote, $couponCode)
 {
     $quote->setCouponCode($couponCode);
     $quote->setTotalsCollectedFlag(false)->collectTotals();
     $quote->save();
 }
开发者ID:danlins,项目名称:magento-multi-coupons,代码行数:12,代码来源:Service.php


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