Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Paypal_Adminhtml_Paypal_ReportsController
  • Mage_Paypal_Block_Adminhtml_Settlement_Details
  • Mage_Paypal_Block_Adminhtml_Settlement_Details_Form
  • Mage_Paypal_Block_Adminhtml_Settlement_Report
  • Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid
  • Mage_Paypal_Block_Adminhtml_System_Config_ApiWizard
  • Mage_Paypal_Block_Adminhtml_System_Config_Field_Country
  • Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Store
  • Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Advanced
  • Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info
  • Mage_Paypal_Block_Express_Form
  • Mage_Paypal_Block_Express_Review
  • Mage_Paypal_Block_Express_Review_Billing
  • Mage_Paypal_Block_Express_Review_Details
  • Mage_Paypal_Block_Express_Review_Shipping
  • Mage_Paypal_Block_Express_Shortcut
  • Mage_Paypal_Block_Hosted_Pro_Form
  • Mage_Paypal_Block_Hosted_Pro_Iframe
  • Mage_Paypal_Block_Hosted_Pro_Info
  • Mage_Paypal_Block_Iframe
  • Mage_Paypal_Block_Logo
  • Mage_Paypal_Block_Payflow_Advanced_Form
  • Mage_Paypal_Block_Payflow_Advanced_Iframe
  • Mage_Paypal_Block_Payflow_Advanced_Info
  • Mage_Paypal_Block_Payflow_Link_Form
  • Mage_Paypal_Block_Payflow_Link_Iframe
  • Mage_Paypal_Block_Payflow_Link_Info
  • Mage_Paypal_Block_Payment_Info
  • Mage_Paypal_Block_Standard_Form
  • Mage_Paypal_Block_Standard_Redirect
  • Mage_Paypal_Controller_Express_Abstract
  • Mage_Paypal_ExpressController
  • Mage_Paypal_Helper_Data
  • Mage_Paypal_Helper_Hss
  • Mage_Paypal_HostedproController
  • Mage_Paypal_IpnController
  • Mage_Paypal_Model_Api_Abstract
  • Mage_Paypal_Model_Api_Nvp
  • Mage_Paypal_Model_Api_Standard
  • Mage_Paypal_Model_Cart
  • Mage_Paypal_Model_Cert
  • Mage_Paypal_Model_Config
  • Mage_Paypal_Model_Direct
  • Mage_Paypal_Model_Express
  • Mage_Paypal_Model_Express_Checkout
  • Mage_Paypal_Model_Hostedpro
  • Mage_Paypal_Model_Hostedpro_Request
  • Mage_Paypal_Model_Info
  • Mage_Paypal_Model_Ipn
  • Mage_Paypal_Model_Method_Agreement
  • Mage_Paypal_Model_Mysql4_Cert
  • Mage_Paypal_Model_Mysql4_Report_Settlement
  • Mage_Paypal_Model_Mysql4_Report_Settlement_Row
  • Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection
  • Mage_Paypal_Model_Mysql4_Setup
  • Mage_Paypal_Model_Observer
  • Mage_Paypal_Model_Payflow_Request
  • Mage_Paypal_Model_Payflowadvanced
  • Mage_Paypal_Model_Payflowlink
  • Mage_Paypal_Model_Payflowpro
  • Mage_Paypal_Model_Payment_Transaction
  • Mage_Paypal_Model_Pro
  • Mage_Paypal_Model_Report_Settlement
  • Mage_Paypal_Model_Report_Settlement_Row
  • Mage_Paypal_Model_Resource_Cert
  • Mage_Paypal_Model_Resource_Report_Settlement
  • Mage_Paypal_Model_Resource_Report_Settlement_Row
  • Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection
  • Mage_Paypal_Model_Resource_Setup
  • Mage_Paypal_Model_Session
  • Mage_Paypal_Model_Standard
  • Mage_Paypal_Model_System_Config_Backend_Cert
  • Mage_Paypal_Model_System_Config_Backend_Cron
  • Mage_Paypal_Model_System_Config_Backend_MerchantCountry
  • Mage_Paypal_Model_System_Config_Source_BuyerCountry
  • Mage_Paypal_Model_System_Config_Source_FetchingSchedule
  • Mage_Paypal_Model_System_Config_Source_Logo
  • Mage_Paypal_Model_System_Config_Source_MerchantCountry
  • Mage_Paypal_Model_System_Config_Source_PaymentActions
  • Mage_Paypal_Model_System_Config_Source_PaymentActions_Express
  • Mage_Paypal_Model_System_Config_Source_RequireBillingAddress
  • Mage_Paypal_Model_System_Config_Source_UrlMethod
  • Mage_Paypal_PayflowadvancedController
  • Mage_Paypal_PayflowController
  • Mage_Paypal_StandardController

Exceptions

  • Mage_Paypal_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Paypal
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Paypal Express Onepage checkout block
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_Paypal
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Paypal_Block_Express_Review extends Mage_Core_Block_Template
 35: {
 36:     /**
 37:      * @var Mage_Sales_Model_Quote
 38:      */
 39:     protected $_quote;
 40: 
 41:     /**
 42:      * Currently selected shipping rate
 43:      *
 44:      * @var Mage_Sales_Model_Quote_Address_Rate
 45:      */
 46:     protected $_currentShippingRate = null;
 47: 
 48:     /**
 49:      * Paypal action prefix
 50:      *
 51:      * @var string
 52:      */
 53:     protected $_paypalActionPrefix = 'paypal';
 54: 
 55:     /**
 56:      * Quote object setter
 57:      *
 58:      * @param Mage_Sales_Model_Quote $quote
 59:      * @return Mage_Paypal_Block_Express_Review
 60:      */
 61:     public function setQuote(Mage_Sales_Model_Quote $quote)
 62:     {
 63:         $this->_quote = $quote;
 64:         return $this;
 65:     }
 66: 
 67:     /**
 68:      * Return quote billing address
 69:      *
 70:      * @return Mage_Sales_Model_Quote_Address
 71:      */
 72:     public function getBillingAddress()
 73:     {
 74:         return $this->_quote->getBillingAddress();
 75:     }
 76: 
 77:     /**
 78:      * Return quote shipping address
 79:      *
 80:      * @return Mage_Sales_Model_Quote_Address
 81:      */
 82:     public function getShippingAddress()
 83:     {
 84:         if ($this->_quote->getIsVirtual()) {
 85:             return false;
 86:         }
 87:         return $this->_quote->getShippingAddress();
 88:     }
 89: 
 90:     /**
 91:      * Get HTML output for specified address
 92:      *
 93:      * @param Mage_Sales_Model_Quote_Address
 94:      * @return string
 95:      */
 96:     public function renderAddress($address)
 97:     {
 98:         return $address->getFormated(true);
 99:     }
100: 
101:     /**
102:      * Return carrier name from config, base on carrier code
103:      *
104:      * @param $carrierCode string
105:      * @return string
106:      */
107:     public function getCarrierName($carrierCode)
108:     {
109:         if ($name = Mage::getStoreConfig("carriers/{$carrierCode}/title")) {
110:             return $name;
111:         }
112:         return $carrierCode;
113:     }
114: 
115:     /**
116:      * Get either shipping rate code or empty value on error
117:      *
118:      * @param Varien_Object $rate
119:      * @return string
120:      */
121:     public function renderShippingRateValue(Varien_Object $rate)
122:     {
123:         if ($rate->getErrorMessage()) {
124:             return '';
125:         }
126:         return $rate->getCode();
127:     }
128: 
129:     /**
130:      * Get shipping rate code title and its price or error message
131:      *
132:      * @param Varien_Object $rate
133:      * @param string $format
134:      * @param string $inclTaxFormat
135:      * @return string
136:      */
137:     public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)')
138:     {
139:         $renderedInclTax = '';
140:         if ($rate->getErrorMessage()) {
141:             $price = $rate->getErrorMessage();
142:         } else {
143:             $price = $this->_getShippingPrice($rate->getPrice(),
144:                 $this->helper('tax')->displayShippingPriceIncludingTax());
145: 
146:             $incl = $this->_getShippingPrice($rate->getPrice(), true);
147:             if (($incl != $price) && $this->helper('tax')->displayShippingBothPrices()) {
148:                 $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl);
149:             }
150:         }
151:         return sprintf($format, $rate->getMethodTitle(), $price, $renderedInclTax);
152:     }
153: 
154:     /**
155:      * Getter for current shipping rate
156:      *
157:      * @return Mage_Sales_Model_Quote_Address_Rate
158:      */
159:     public function getCurrentShippingRate()
160:     {
161:         return $this->_currentShippingRate;
162:     }
163: 
164:     /**
165:      * Set paypal actions prefix
166:      */
167:     public function setPaypalActionPrefix($prefix)
168:     {
169:         $this->_paypalActionPrefix = $prefix;
170:     }
171: 
172:     /**
173:      * Return formatted shipping price
174:      *
175:      * @param float $price
176:      * @param bool $isInclTax
177:      *
178:      * @return bool
179:      */
180:     protected function _getShippingPrice($price, $isInclTax)
181:     {
182:         return $this->_formatPrice($this->helper('tax')->getShippingPrice($price, $isInclTax, $this->_address));
183:     }
184: 
185:     /**
186:      * Format price base on store convert price method
187:      *
188:      * @param float $price
189:      * @return string
190:      */
191:     protected function _formatPrice($price)
192:     {
193:         return $this->_quote->getStore()->convertPrice($price, true);
194:     }
195: 
196:     /**
197:      * Retrieve payment method and assign additional template values
198:      *
199:      * @return Mage_Paypal_Block_Express_Review
200:      */
201:     protected function _beforeToHtml()
202:     {
203:         $methodInstance = $this->_quote->getPayment()->getMethodInstance();
204:         $this->setPaymentMethodTitle($methodInstance->getTitle());
205:         $this->setUpdateOrderSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateOrder"));
206:         $this->setUpdateShippingMethodsUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateShippingMethods"));
207: 
208:         $this->setShippingRateRequired(true);
209:         if ($this->_quote->getIsVirtual()) {
210:             $this->setShippingRateRequired(false);
211:         } else {
212:             // prepare shipping rates
213:             $this->_address = $this->_quote->getShippingAddress();
214:             $groups = $this->_address->getGroupedAllShippingRates();
215:             if ($groups && $this->_address) {
216:                 $this->setShippingRateGroups($groups);
217:                 // determine current selected code & name
218:                 foreach ($groups as $code => $rates) {
219:                     foreach ($rates as $rate) {
220:                         if ($this->_address->getShippingMethod() == $rate->getCode()) {
221:                             $this->_currentShippingRate = $rate;
222:                             break(2);
223:                         }
224:                     }
225:                 }
226:             }
227: 
228:             // misc shipping parameters
229:             $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/saveShippingMethod"))
230:                 ->setCanEditShippingAddress($this->_quote->getMayEditShippingAddress())
231:                 ->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod())
232:             ;
233:         }
234: 
235:         $this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/express/edit"))
236:             ->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/express/placeOrder"));
237: 
238:         return parent::_beforeToHtml();
239:     }
240: }
241: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0