本文整理汇总了PHP中Mage_Sales_Model_Order::getQuote方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getQuote方法的具体用法?PHP Mage_Sales_Model_Order::getQuote怎么用?PHP Mage_Sales_Model_Order::getQuote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getQuote方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCustomerBalanceModelFromSalesEntity
/**
* Get customer balance model using sales entity
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $salesEntity
*
* @return Enterprise_CustomerBalance_Model_Balance|bool
*/
public function getCustomerBalanceModelFromSalesEntity($salesEntity)
{
if ($salesEntity instanceof Mage_Sales_Model_Order) {
$customerId = $salesEntity->getCustomerId();
$quote = $salesEntity->getQuote();
} elseif ($salesEntity instanceof Mage_Sales_Model_Quote) {
$customerId = $salesEntity->getCustomer()->getId();
$quote = $salesEntity;
} else {
return false;
}
if (!$customerId) {
return false;
}
$customerBalanceModel = Mage::getModel('enterprise_customerbalance/balance')->setCustomerId($customerId)->setWebsiteId(Mage::app()->getStore($salesEntity->getStoreId())->getWebsiteId())->loadByCustomer();
if ($quote->getBaseCustomerBalanceVirtualAmount() > 0) {
$customerBalanceModel->setAmount($customerBalanceModel->getAmount() + $quote->getBaseCustomerBalanceVirtualAmount());
}
return $customerBalanceModel;
}
示例2: _getStoreIdByObject
/**
* Retrieve storeId from object
*
* @param OnePica_AvaTax_Model_Sales_Quote_Address|Mage_Sales_Model_Order $object
* @return int
*/
protected function _getStoreIdByObject($object)
{
if ($object instanceof OnePica_AvaTax_Model_Sales_Quote_Address) {
return $object->getQuote()->getStoreId();
}
return $object->getStoreId();
}
示例3: getPrimaryShippingAddress
/**
* get shipping address with the highest subtotal amount.
*
* @param Mage_Sales_Model_Order
* @return Mage_Sales_Model_Order_Address|null
*/
protected function getPrimaryShippingAddress(Mage_Sales_Model_Order $order)
{
$collection = $order->getAddressesCollection();
$address = $collection->getItemByColumnValue('quote_address_id', $this->getQuotePrimaryShippingAddressId($order->getQuote()));
return $address;
}
示例4: buildPlanItemsForSubscription
/**
* @param Mage_Sales_Model_Order $order
*
* @return array
*/
public function buildPlanItemsForSubscription($order)
{
$list = [];
$orderItems = $order->getItemsCollection();
$orderSubtotal = $order->getQuote()->getSubtotal();
$orderDiscount = $order->getDiscountAmount() * -1;
$discount = null;
if (!empty($orderDiscount)) {
$discountPercentage = $orderDiscount * 100 / $orderSubtotal;
$discountPercentage = number_format(floor($discountPercentage * 100) / 100, 2);
$discount = [['discount_type' => 'percentage', 'percentage' => $discountPercentage]];
}
foreach ($orderItems as $item) {
$product = Mage::getModel('catalog/product')->load($item->getProductId());
if ($product->getTypeID() !== 'subscription') {
Mage::throwException("O produto {$item->getName()} não é uma assinatura.");
return false;
}
$productVindiId = $this->findOrCreateProduct(array('sku' => $item->getSku(), 'name' => $item->getName()));
for ($i = 1; $i <= $item->getQtyOrdered(); $i++) {
$list[] = ['product_id' => $productVindiId, 'pricing_schema' => ['price' => $item->getPrice()], 'discounts' => $discount];
}
}
// Create product for shipping
$productVindiId = $this->findOrCreateProduct(array('sku' => 'frete', 'name' => 'Frete'));
$list[] = ['product_id' => $productVindiId, 'pricing_schema' => ['price' => $order->getShippingAmount()]];
return $list;
}
示例5: _getTaxClassId
/**
* Get tax class id
*
* @param OnePica_AvaTax_Model_Sales_Quote_Address|Mage_Sales_Model_Order $object
* @return int
*/
protected function _getTaxClassId($object)
{
if ($object instanceof OnePica_AvaTax_Model_Sales_Quote_Address) {
return $object->getQuote()->getCustomerTaxClassId();
}
return Mage::getSingleton('customer/group')->load($object->getCustomerGroupId())->getTaxClassId();
}