本文整理汇总了PHP中Mage_Sales_Model_Quote::getOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getOrder方法的具体用法?PHP Mage_Sales_Model_Quote::getOrder怎么用?PHP Mage_Sales_Model_Quote::getOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getOrder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPgAddress
/**
* Gets a PakjeGemak address for either a quote or an order object.
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
*
* @return false|Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address|TIG_MyParcel2014_Model_Shipment
*/
public function getPgAddress($object)
{
/**
* Get all addresses for the specified object.
*/
if ($object instanceof Mage_Sales_Model_Quote) {
$addressCollection = $object->getAllAddresses();
} elseif ($object instanceof Mage_Sales_Model_Order) {
$addressCollection = $object->getAddressesCollection();
} elseif ($object instanceof TIG_MyParcel2014_Model_Shipment) {
$order = $object->getOrder();
if (!$order) {
return false;
}
$addressCollection = $order->getAddressesCollection();
} else {
return false;
}
/**
* Go through each address and check if it's a PakjeGemak address.
*
* @var Mage_Sales_Model_Quote_Address|Mage_Sales_Model_Order_Address $address
*/
$pgAddress = false;
foreach ($addressCollection as $address) {
if ($address->getAddressType() == self::PG_ADDRESS_TYPE) {
$pgAddress = $address;
break;
}
}
/**
* Return the PakjeGemak address or false if none was found.
*/
return $pgAddress;
}
示例2: isObjectActionable
/**
* Determines if the object (quote, invoice, or credit memo) should use AvaTax services
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
* @param Mage_Sales_Model_Quote_Address $shippingAddress
* @return bool
*/
public function isObjectActionable($object, $shippingAddress = null)
{
$storeId = $object->getStore()->getId();
//is action enabled?
$action = $object->getOrder() ? OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT : OnePica_AvaTax_Model_Config::ACTION_CALC;
if (Mage::getStoreConfig('tax/avatax/action', $storeId) < $action) {
return false;
}
if (!$shippingAddress) {
$shippingAddress = $object->getShippingAddress();
}
if (!$shippingAddress) {
$shippingAddress = $object->getBillingAddress();
}
//is the region filtered?
if (!$this->isAddressActionable($shippingAddress, $storeId, OnePica_AvaTax_Model_Config::REGIONFILTER_TAX)) {
return false;
}
return true;
}
示例3: getRequestBasket
/**
* Gets all needed Informations for shopping-basket Block of the Request
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
* @param float $amount
* @param array $articleList
* @return array
*/
public function getRequestBasket($object, $amount = '', $articleList = '')
{
$basket = array();
if ($object instanceof Mage_Sales_Model_Order) {
$basket['currency'] = $object->getOrderCurrencyCode();
} else {
if ($object instanceof Mage_Sales_Model_Quote) {
$basket['currency'] = $object->getQuoteCurrencyCode();
} else {
$basket['currency'] = $object->getOrder()->getOrderCurrencyCode();
}
}
if ($articleList != '') {
$basket['items'] = $articleList;
} else {
$basket['items'] = $this->getArticles($object);
}
// If no positiv item is remained in basket clear basket
if (!$this->_anyPositiveItems($basket['items'])) {
$basket['items'] = array();
}
if (is_numeric($amount)) {
$basket['amount'] = $amount;
} else {
if ($object->getGrandTotal() > 0) {
$basket['amount'] = $object->getGrandTotal();
} elseif (count($basket['items']) == 0) {
$basket['amount'] = 0;
} else {
$basket['amount'] = $this->getAmountByItems($basket['items']);
}
}
// Ensure that the basket amount is never less than zero
// In certain cases (i.e. in case of maloperation) the amount can become < 0
if ($basket['amount'] < 0) {
$basket['amount'] = 0;
}
return $basket;
}