本文整理匯總了PHP中mage::getSingleton方法的典型用法代碼示例。如果您正苦於以下問題:PHP mage::getSingleton方法的具體用法?PHP mage::getSingleton怎麽用?PHP mage::getSingleton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mage
的用法示例。
在下文中一共展示了mage::getSingleton方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$customerId = mage::getSingleton('customer/session')->getId();
$customer = mage::getModel('customer/customer')->load($customerId);
if (is_object($customer) || $customer->getId()) {
$this->_customer = $customer;
}
}
示例2: canSave
/**
* Can Save Enabled
* @return string
*/
public function canSave()
{
$cansave = mage::getStoreConfig('payment/pinpayments/can_save');
$isLoggedIn = mage::getSingleton('customer/session')->isLoggedIn();
if ($cansave && $isLoggedIn) {
return true;
}
return false;
}
示例3: getAction
/**
* Add product to shopping cart action
*/
public function getAction()
{
try {
if (!$this->getRequest()->isPost() && !mage::getSingleton('customer/session')->isLoggedIn()) {
return;
}
$result = array();
$data = $this->getRequest()->getPost('payment', array());
if ($data['method'] != 'pinpayments') {
return;
}
$pinCustomerModel = mage::getModel('pinpayments/customer');
$cardToken = array('response' => $pinCustomerModel->getCustomerTokenCard());
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody(json_encode($cardToken));
} catch (Exception $e) {
Mage::logException($e);
}
return $this;
}
示例4: getStage1FormData
/**
* @return array
*/
public function getStage1FormData()
{
$session = mage::getSingleton('core/session');
return $session->getEsendexSmsStage1FormData();
}