0byt3m1n1
Path:
/
data
/
applications
/
aps
/
magento
/
1.1.3-2
/
standard
/
htdocs
/
app
/
code
/
core
/
Mage
/
Checkout
/
Helper
/
[
Home
]
File: Data.php
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * @category Mage * @package Mage_Checkout * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Checkout default helper * * @author Magento Core Team <core@magentocommerce.com> */ class Mage_Checkout_Helper_Data extends Mage_Core_Helper_Abstract { protected $_agreements = null; /** * Retrieve checkout session model * * @return Mage_Checkout_Model_Session */ public function getCheckout() { return Mage::getSingleton('checkout/session'); } /** * Retrieve checkout quote model object * * @return Mage_Sales_Model_Quote */ public function getQuote() { return $this->getCheckout()->getQuote(); } public function formatPrice($price) { return $this->getQuote()->getStore()->formatPrice($price); } public function convertPrice($price, $format=true) { return $this->getQuote()->getStore()->convertPrice($price, $format); } public function getRequiredAgreementIds() { if (is_null($this->_agreements)) { if (!Mage::getStoreConfigFlag('checkout/options/enable_agreements')) { $this->_agreements = array(); } else { $this->_agreements = Mage::getModel('checkout/agreement')->getCollection() ->addStoreFilter(Mage::app()->getStore()->getId()) ->addFieldToFilter('is_active', 1) ->getAllIds(); } } return $this->_agreements; } /** * Get onepage checkout availability * * @return bool */ public function canOnepageCheckout() { if (Mage::getStoreConfig('checkout/options/onepage_checkout_disabled')) { return false; } return true; } public function getPriceInclTax($item) { $price = ($item->getCalculationPrice() ? $item->getCalculationPrice() : $item->getPrice()); $qty = ($item->getQty() ? $item->getQty() : ($item->getQtyOrdered() ? $item->getQtyOrdered() : 1)); $tax = ($item->getTaxBeforeDiscount() ? $item->getTaxBeforeDiscount() : $item->getTaxAmount()); return $price+($tax/$qty); } public function getSubtotalInclTax($item) { $tax = ($item->getTaxBeforeDiscount() ? $item->getTaxBeforeDiscount() : $item->getTaxAmount()); return $item->getRowTotal()+$tax; } }