本文整理汇总了PHP中Mage::getSingleTon方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getSingleTon方法的具体用法?PHP Mage::getSingleTon怎么用?PHP Mage::getSingleTon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getSingleTon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reviewscollection
public function reviewscollection()
{
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$customer_id = Mage::getSingleTon('customer/session')->getId();
$customer_reviews = Mage::getResourceModel('reviewsplus/reviewsplus')->customerreviews($customer_id);
return $customer_reviews;
}
}
示例2: _construct
protected function _construct()
{
$this->db = new Varien_Data_Collection_Db();
$this->db->__construct(Mage::getSingleTon('core/resource')->getConnection('comprejunto'));
$this->_init('comprejunto/comprejunto');
}
示例3: termsx
public function termsx()
{
$total = Mage::getSingleTon('checkout/session')->getQuote()->getShippingAddress()->getGrandTotal();
return Mage::helper('partpayment')->getPlclass($total);
}
示例4: getPlclass
function getPlclass($total)
{
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
$currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
$_directory = Mage::helper('directory');
$payment_option = array();
$quote = Mage::getSingleTon('checkout/session')->getQuote();
$address = $quote->getShippingAddress();
$isoCode3 = 'SWE';
//Mage::getModel('directory/country')->load($address->getCountryId())->getIso3Code();
$isoCode2 = Mage::getModel('directory/country')->load($address->getCountryId())->getIso2Code();
$collection = Mage::getModel('partpayment/pclass')->getCollection()->addFieldToFilter('country', $isoCode2)->addFieldToFilter('store_id', Mage::app()->getStore()->getId());
if ($collection->getSize() == 0) {
$collection = Mage::getModel('partpayment/pclass')->getCollection()->addFieldToFilter('country', $isoCode2)->addFieldToFilter('store_id', 0);
}
// Maps countries to currencies
$country_to_currency = array('NOR' => 'NOK', 'SWE' => 'SEK', 'FIN' => 'EUR', 'DNK' => 'DKK', 'DEU' => 'EUR', 'NLD' => 'EUR');
$country_to_currency = array('NOR' => 'NOK', 'SWE' => 'SEK', 'FIN' => 'EUR', 'DNK' => 'DKK', 'DEU' => 'EUR', 'NLD' => 'EUR');
foreach ($collection as $pclass) {
// 0 - Campaign
// 1 - Account
// 2 - Special
// 3 - Fixed
if (!in_array($pclass->getType(), array(0, 2, 1, 3, 4))) {
continue;
}
if ($pclass->getType() == 2) {
$monthly_cost = -1;
} else {
if ($total < $pclass->getMinamount() || $total > $pclass->getMaxamount() && $pclass->getMaxamount() > 0) {
continue;
}
if ($pclass->getType() == 3) {
continue;
} else {
$sum = $total;
$lowest_payment = $this->getLowestPaymentAccount($isoCode3);
$monthly_cost = 0;
$monthly_fee = $pclass->getHandlingfee();
$start_fee = $pclass->getStartfee();
$sum += $start_fee;
$base = $pclass->getType() == 1;
$minimum_payment = $pclass->getType() === 1 ? $this->getLowestPaymentAccount($isoCode3) : 0;
if ($pclass->getNbrofmonths() == 0) {
$payment = $sum;
} elseif ((int) $pclass->getInterestrate() == 0) {
$payment = $sum / $pclass->getNbrofmonths();
} else {
// Because Interest rate is in decimal for example 0.12 no need to multiply by 100
$interest_rate = $pclass->getInterestrate() / 12;
$payment = $sum * $interest_rate / (1 - pow(1 + $interest_rate, -$pclass->getNbrofmonths()));
}
$payment += $monthly_fee;
$balance = $sum;
$pay_data = array();
$months = $pclass->getNbrofmonths();
while ($months != 0 && $balance > 0.01) {
// Because Interest rate is in decimal for example 0.12 no need to multiply by 100
$interest = $balance * $pclass->getInterestrate() / 12;
$new_balance = $balance + $interest + $monthly_fee;
if ($minimum_payment >= $new_balance || $payment >= $new_balance) {
$pay_data[] = $new_balance;
break;
}
$new_payment = max($payment, $minimum_payment);
if ($base) {
$new_payment = max($new_payment, $balance / 24.0 + $monthly_fee + $interest);
}
$balance = $new_balance - $new_payment;
$pay_data[] = $new_payment;
$months -= 1;
}
$monthly_cost = round(isset($pay_data[0]) ? $pay_data[0] : 0, 0);
if ($monthly_cost < 0.01) {
continue;
}
if ($pclass->getType() == 1 && $monthly_cost < $lowest_payment) {
$monthly_cost = $lowest_payment;
}
if ($pclass->getType() == 0 && $monthly_cost < $lowest_payment) {
continue;
}
}
}
$monthly_cost = $_directory->currencyConvert($monthly_cost, $baseCurrencyCode, $currentCurrencyCode);
$payment_option_temp['monthly_cost'] = $monthly_cost;
$payment_option_temp['nbrofmonths'] = $pclass->getNbrofmonths();
$payment_option_temp['pclass_id'] = $pclass->getPaymentplanid();
$payment_option_temp['months'] = $pclass->getNbrofmonths();
$payment_option_temp['description'] = $pclass->getDescription();
$payment_option[] = $payment_option_temp;
}
return $payment_option;
}
示例5: getTitle
public function getTitle()
{
$quote = Mage::getSingleTon('checkout/session')->getQuote();
$address = $quote->getShippingAddress();
$title = '';
if ($address) {
$total = $address->getGrandTotal();
$title = Mage::helper('partpayment')->getLowPclass($total);
}
$preTitle = strlen(Mage::getStoreConfig('payment/partpayment/title')) > 0 ? Mage::helper('partpayment')->__(Mage::getStoreConfig('payment/partpayment/title')) : Mage::helper('partpayment')->__('Billmate Partpayment');
return $preTitle . $title;
//return $this->getConfigData('title').$title;
}