本文整理汇总了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();
}
}
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}