本文整理汇总了PHP中Mage_Sales_Model_Order::getBaseSubtotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getBaseSubtotal方法的具体用法?PHP Mage_Sales_Model_Order::getBaseSubtotal怎么用?PHP Mage_Sales_Model_Order::getBaseSubtotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getBaseSubtotal方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveCompensation
public function saveCompensation(Varien_Event_Observer $observer)
{
$order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($orderId);
$orderPriceExldTax = $order->getBaseSubtotal();
// calculate commission for price WITHOUT TAX
Mage::getModel('magemlm/commissions')->calculateCommissions(Mage::helper('customer')->getCustomer()->getId(), $orderId, $orderPriceExldTax);
}
示例2: _render
/**
* (re)Render all items and totals
*/
protected function _render()
{
if (!$this->_shouldRender) {
return;
}
// regular items from the sales entity
$this->_items = array();
foreach ($this->_salesEntity->getAllItems() as $item) {
if (!$item->getParentItem()) {
$this->_addRegularItem($item);
}
}
end($this->_items);
$lastRegularItemKey = key($this->_items);
// regular totals
$shippingDescription = '';
if ($this->_salesEntity instanceof Mage_Sales_Model_Order) {
$shippingDescription = $this->_salesEntity->getShippingDescription();
$this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), self::TOTAL_TAX => $this->_salesEntity->getBaseTaxAmount(), self::TOTAL_SHIPPING => $this->_salesEntity->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($this->_salesEntity->getBaseDiscountAmount()));
$this->_applyHiddenTaxWorkaround($this->_salesEntity);
} else {
$address = $this->_salesEntity->getIsVirtual() ? $this->_salesEntity->getBillingAddress() : $this->_salesEntity->getShippingAddress();
$shippingDescription = $address->getShippingDescription();
$this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), self::TOTAL_TAX => $address->getBaseTaxAmount(), self::TOTAL_SHIPPING => $address->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($address->getBaseDiscountAmount()));
$this->_applyHiddenTaxWorkaround($address);
}
$originalDiscount = $this->_totals[self::TOTAL_DISCOUNT];
// arbitrary items, total modifications
Mage::dispatchEvent('paypal_prepare_line_items', array('paypal_cart' => $this));
// distinguish original discount among the others
if ($originalDiscount > 0.0001 && isset($this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT])) {
$this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT][] = Mage::helper('sales')->__('Discount (%s)', Mage::app()->getStore()->convertPrice($originalDiscount, true, false));
}
// discount, shipping as items
if ($this->_isDiscountAsItem && $this->_totals[self::TOTAL_DISCOUNT]) {
$this->addItem(Mage::helper('paypal')->__('Discount'), 1, -1.0 * $this->_totals[self::TOTAL_DISCOUNT], $this->_renderTotalLineItemDescriptions(self::TOTAL_DISCOUNT));
}
$shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription);
if ($this->_isShippingAsItem && (double) $this->_totals[self::TOTAL_SHIPPING]) {
$this->addItem(Mage::helper('paypal')->__('Shipping'), 1, (double) $this->_totals[self::TOTAL_SHIPPING], $shippingItemId);
}
// compound non-regular items into subtotal
foreach ($this->_items as $key => $item) {
if ($key > $lastRegularItemKey && $item->getAmount() != 0) {
$this->_totals[self::TOTAL_SUBTOTAL] += $item->getAmount();
}
}
$this->_validate();
// if cart items are invalid, prepare cart for transfer without line items
if (!$this->_areItemsValid) {
$this->removeItem($shippingItemId);
}
$this->_shouldRender = false;
}
示例3: _getOrderData
/**
* Get order request data as array
*
* @param Mage_Sales_Model_Order $order
* @return array
*/
protected function _getOrderData(Mage_Sales_Model_Order $order)
{
$request = array('subtotal' => $this->_formatPrice($order->getBaseSubtotal()), 'tax' => $this->_formatPrice($order->getBaseTaxAmount()), 'shipping' => $this->_formatPrice($order->getBaseShippingAmount()), 'invoice' => $order->getIncrementId(), 'address_override' => 'true', 'currency_code' => $order->getBaseCurrencyCode(), 'buyer_email' => $order->getCustomerEmail(), 'discount' => $this->_formatPrice($order->getBaseGiftCardsAmount() + abs($order->getBaseDiscountAmount()) + $order->getBaseCustomerBalanceAmount()));
// append to request billing address data
if ($billingAddress = $order->getBillingAddress()) {
$request = array_merge($request, $this->_getBillingAddress($billingAddress));
}
// append to request shipping address data
if ($shippingAddress = $order->getShippingAddress()) {
$request = array_merge($request, $this->_getShippingAddress($shippingAddress));
}
return $request;
}
示例4: _fillCartInformation
/**
* @param array $data
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
*/
private function _fillCartInformation(&$data, $object)
{
$productIids = array();
$productQtys = array();
$productStyleIds = array();
/** @var Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Order_Item $item */
foreach ($object->getAllVisibleItems() as $item) {
$productIids[] = $item->getProduct()->getIid();
$productQtys[] = is_null($item->getQtyOrdered()) ? (int) $item->getQty() : (int) $item->getQtyOrdered();
$productStyleIds[] = $item->getProduct()->getNumber() . '-' . $item->getProduct()->getColorCode();
}
$data['productStyleId'] = implode(',', $productStyleIds);
$data['cartProductIds'] = implode(',', $productIids);
$data['cartProductQtys'] = implode(',', $productQtys);
$data['cartTotalNetto'] = round($object->getBaseSubtotal(), 2);
$data['cartTotalBrutto'] = round($object->getBaseGrandTotal(), 2);
$data['customerId'] = (int) $object->getCustomerId();
// For zanox tracking
if (array_key_exists('zanpid', $_COOKIE) && $_COOKIE['zanpid'] != '') {
$data['zanpid'] = $_COOKIE['zanpid'];
}
}
示例5: autoExportJobs
/** Send order to MailChimp Automatically by Order Status
*
*
*/
public function autoExportJobs($storeId)
{
$allow_sent = false;
//Get status options selected in the Configuration
$states = explode(',', Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_STATUS, $storeId));
$max = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_MAX, $storeId);
$count = 0;
foreach ($states as $state) {
if ($max == $count) {
break;
}
$ecommerceTable = Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce');
if ($state != 'all_status') {
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
// $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null AND main_table.status = \'' . $state . '\'')
// ->limit($max - $count);
$orders->getSelect()->where('main_table.status = \'' . $state . '\' ' . 'AND main_table.entity_id NOT IN ' . "(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")->limit($max - $count);
} else {
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
// $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null')
// ->limit($max - $count);
$orders->getSelect()->where('main_table.entity_id NOT IN ' . "(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")->limit($max - $count);
}
$count += count($orders);
foreach ($orders as $order) {
$this->_order = $order;
$ordersToSend = Mage::getModel('monkey/asyncorders')->getCollection()->addFieldToFilter('processed', array('eq' => 0));
foreach ($ordersToSend as $orderToSend) {
$info = (array) unserialize($orderToSend->getInfo());
if ($this->_order->getIncrementId() == $info['id']) {
continue;
}
}
$api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
if (!$api) {
return false;
}
$subtotal = $this->_order->getBaseSubtotal();
$discount = (double) $this->_order->getBaseDiscountAmount();
if ($discount != 0) {
$subtotal = $subtotal + $discount;
}
$createdAtArr = str_split($this->_order->getCreatedAt(), 10);
$this->_info = array('id' => $this->_order->getIncrementId(), 'total' => $subtotal, 'shipping' => $this->_order->getBaseShippingAmount(), 'tax' => $this->_order->getBaseTaxAmount(), 'store_id' => $this->_order->getStoreId(), 'store_name' => $this->_order->getStoreName(), 'order_date' => $createdAtArr[0], 'plugin_id' => 1215, 'items' => array());
$email = $this->_order->getCustomerEmail();
$campaign = $this->_order->getEbizmartsMagemonkeyCampaignId();
$this->setItemstoSend($storeId);
$rs = false;
if ($email && $campaign) {
$this->_info['email_id'] = $email;
$this->_info['campaign_id'] = $campaign;
if (Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
$sync = Mage::getModel('monkey/asyncorders');
$this->_info['order_id'] = $this->_order->getId();
$sync->setInfo(serialize($this->_info))->setCreatedAt($createdAtArr[0])->setProcessed(0)->save();
$rs['complete'] = true;
} else {
//Send order to MailChimp
$rs = $api->campaignEcommOrderAdd($this->_info);
}
} else {
$this->_info['email'] = $email;
if (Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
$sync = Mage::getModel('monkey/asyncorders');
$this->_info['order_id'] = $this->_order->getId();
$sync->setInfo(serialize($this->_info))->setCreatedAt(Mage::getModel('core/date')->gmtDate())->setProcessed(0)->save();
$rs['complete'] = true;
} else {
$rs = $api->ecommOrderAdd($this->_info);
}
}
if (isset($rs['complete']) && $rs['complete'] == TRUE && !Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
$order = Mage::getModel('monkey/ecommerce')->setOrderIncrementId($this->_info['id'])->setOrderId($this->_info['order_id'])->setMcEmailId($this->_info['email'])->setCreatedAt($createdAtArr[0])->setStoreId($this->_info['store_id']);
if (isset($this->_info['campaign_id']) && $this->_info['campaign_id']) {
$order->setMcCampaignId($this->_info['campaign_id']);
}
$order->save();
//$this->_logCall();
}
}
}
}
示例6: toQuoteShippingAddress
/**
* Convert order to shipping address
*
* @param Mage_Sales_Model_Order $order
* @return Mage_Sales_Model_Quote_Address
*/
public function toQuoteShippingAddress(Mage_Sales_Model_Order $order)
{
$address = $this->addressToQuoteAddress($order->getShippingAddress());
$address->setWeight($order->getWeight())->setShippingMethod($order->getShippingMethod())->setShippingDescription($order->getShippingDescription())->setShippingRate($order->getShippingRate())->setSubtotal($order->getSubtotal())->setTaxAmount($order->getTaxAmount())->setDiscountAmount($order->getDiscountAmount())->setShippingAmount($order->getShippingAmount())->setGiftcertAmount($order->getGiftcertAmount())->setCustbalanceAmount($order->getCustbalanceAmount())->setGrandTotal($order->getGrandTotal())->setBaseSubtotal($order->getBaseSubtotal())->setBaseTaxAmount($order->getBaseTaxAmount())->setBaseDiscountAmount($order->getBaseDiscountAmount())->setBaseShippingAmount($order->getBaseShippingAmount())->setBaseGiftcertAmount($order->getBaseGiftcertAmount())->setBaseCustbalanceAmount($order->getBaseCustbalanceAmount())->setBaseGrandTotal($order->getBaseGrandTotal());
return $address;
}