本文整理汇总了PHP中Mage_Sales_Model_Quote_Item::getAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item::getAddress方法的具体用法?PHP Mage_Sales_Model_Quote_Item::getAddress怎么用?PHP Mage_Sales_Model_Quote_Item::getAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item::getAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAddress
public function testGetAddress()
{
$quote = $this->getMock('Mage_Sales_Model_Quote', array('getShippingAddress', 'getBillingAddress'), array(), '', false);
$quote->expects($this->once())->method('getShippingAddress')->will($this->returnValue('shipping'));
$quote->expects($this->once())->method('getBillingAddress')->will($this->returnValue('billing'));
$this->_model->setQuote($quote);
$quote->setItemsQty(2);
$quote->setVirtualItemsQty(1);
$this->assertEquals('shipping', $this->_model->getAddress(), 'Wrong shipping address');
$quote->setItemsQty(2);
$quote->setVirtualItemsQty(2);
$this->assertEquals('billing', $this->_model->getAddress(), 'Wrong billing address');
}
示例2: getItemTax
/**
* Estimates tax amount for one item. Does not trigger a call if the shipping
* address has no postal code, or if the postal code is set to "-" (OneStepCheckout)
*
* @param Mage_Sales_Model_Quote_Item $item
* @return int
*/
public function getItemTax($item)
{
if ($item->getAddress()->getPostcode() && $item->getAddress()->getPostcode() != '-') {
if ($this->isProductCalculated($item)) {
$tax = 0;
foreach ($item->getChildren() as $child) {
$child->setAddress($item->getAddress());
$tax += $this->getItemTax($child);
}
return (double) $tax;
} else {
$ratesData = $this->_getRates();
$id = $item->getId();
$tax = isset($ratesData['items'][$id]['amt']) ? $ratesData['items'][$id]['amt'] : 0;
return (double) $tax;
}
}
return 0;
}
示例3: _addItemsInCart
/**
* Adds all items in the cart to the request
*
* @param Mage_Sales_Model_Quote_Item $item
* @return int
*/
protected function _addItemsInCart($item)
{
if ($item->getAddress() instanceof Mage_Sales_Model_Quote_Address) {
$items = $item->getAddress()->getAllItems();
} elseif ($item->getQuote() instanceof Mage_Sales_Model_Quote) {
$items = $item->getQuote()->getAllItems();
} else {
$items = array();
}
if (count($items) > 0) {
$this->_initProductCollection($items);
$this->_initTaxClassCollection($item->getAddress());
foreach ($items as $item) {
/** @var Mage_Sales_Model_Quote_Item $item */
$this->_newLine($item);
}
$this->_request->setLines($this->_lines);
}
return count($this->_lines);
}