public function setUp() { parent::setUp(); $this->locale = $this->getModelMock('core/locale', ['getLocale', 'getLocaleCode']); $zendLocale = $this->getMockBuilder('Zend_Locale')->disableOriginalConstructor()->setMethods(['getRegion'])->getMock(); $this->locale->expects($this->any())->method('getLocale')->will($this->returnValue($zendLocale)); $zendLocale->expects($this->any())->method('getRegion')->will($this->returnValue('US')); $this->locale->expects($this->any())->method('getLocaleCode')->will($this->returnValue('en_US')); $this->block = new EbayEnterprise_PayPal_Block_Payment_Mark(); $this->block->setLocale($this->locale); }
/** * Functions returns array with price formatting info for js function * formatCurrency in js/varien/js.js * * @return array */ public function getJsPriceFormat() { $result = parent::getJsPriceFormat(); $result['precision'] = 0; $result['requiredPrecision'] = 0; return $result; }
public function getJsPriceFormat() { // For JavaScript prices $parentFormat = parent::getJsPriceFormat(); $options = Mage::helper('currencymanager')->getOptions(array()); if (isset($options["precision"])) { $parentFormat["requiredPrecision"] = $options["precision"]; $parentFormat["precision"] = $options["precision"]; } return $parentFormat; }
/** * Convert the start datetime (if set) to proper locale/timezone and return * * @param bool $asString * @return Zend_Date|string */ public function exportStartDatetime($asString = true) { $datetime = $this->getStartDatetime(); if (!$datetime || !$this->_locale || !$this->_store) { return; } $date = $this->_locale->storeDate($this->_store, strtotime($datetime), true); if ($asString) { return $date->toString($this->_locale->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)); } return $date; }
/** * Renders grid column * * @param Varien_Object $row * @return string */ public function render(Varien_Object $row) { if ($data = (string) $row->getData($this->getColumn()->getIndex())) { $currency_code = $this->_getCurrencyCode($row); $data = floatval($data) * $this->_getRate($row); $sign = (bool) (int) $this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : ''; $data = sprintf("%f", $data); $data = $this->_locale->currency($currency_code)->toCurrency($data); return $sign . $data; } return $this->getColumn()->getDefault(); }
public function getJsPriceFormat() { $result = parent::getJsPriceFormat(); if (isset($result['precision'])) { $precision = (int) Mage::getStoreConfig('catalog/price/precision'); $diff = $result['precision'] - $precision; $result['precision'] -= $diff; if (isset($result['requiredPrecision'])) { $result['requiredPrecision'] -= $diff; } } return $result; }
/** * Get "What Is PayPal" localized URL * Supposed to be used with "mark" as popup window * * @param Mage_Core_Model_Locale $locale */ public function getPaymentMarkWhatIsPaypalUrl(Mage_Core_Model_Locale $locale = null) { $countryCode = 'US'; if (null !== $locale) { $shouldEmulate = null !== $this->_storeId && Mage::app()->getStore()->getId() != $this->_storeId; if ($shouldEmulate) { $locale->emulate($this->_storeId); } $countryCode = $locale->getLocale()->getRegion(); if ($shouldEmulate) { $locale->revert(); } } return sprintf('https://www.paypal.com/%s/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside', strtolower($countryCode)); }